Osama Natouf
Osama Natouf

Reputation: 59

Convert Raw image to JPG

I have the following issues when I try to run: the input would be something like file=/Downloads/canon_eos_70d_20.CR2

with Raw(file) as raw_image:
        buffered_image = np.array(raw_image.to_buffer())
        im = Image.frombuffer('RGB', (raw_image.metadata.width, raw_image.metadata.height), buffered_image, 'raw',
                              'RGB', 0, 1)
        im.save(os.path.split(file)[1] + '.jpg')
        print('Successfully saved file as JPG.')


'Unsupported Libraw version: %s.%s.%s.' % self.version_number

ImportError: Unsupported Libraw version: 0.19.2.

Any ideas? if not did anyone tried any other way to convert RAW images to jpg?

Upvotes: 1

Views: 1714

Answers (2)

Timilehin A.
Timilehin A.

Reputation: 99

Instead of using rawpy(had a postprocessing I could not seem to understand ) or rawkit (had complications with Libraw). Use PIL

from PIL import Image

file = r"/Downloads/canon_eos_70d_20.CR2"
im = Image.open(file)
rgb_im = im.convert('RGB')
rgb_im.save(file[:-4]+'.JPG')

Upvotes: 3

Roope
Roope

Reputation: 4507

The front page of the rawkit documentation states this under requirements:

  • LibRaw 0.16.x (API version 10)
  • LibRaw 0.17.x (API version 11)

Should be clear then that 0.19.x is not supported.

Upvotes: 0

Related Questions