I am trying to convert a directory of photos from ORF to jpg using python. The image library I am using is
https://github.com/letmaik/rawpy
An error is occuring when I try to read an image from the path. The error is below
with rawpy.imread(fullPath) as raw:
File "/Library/Python/2.7/site-packages/rawpy/__init__.py", line 20, in imread
d.open_file(pathOrFile)
File "rawpy/_rawpy.pyx", line 266, in rawpy._rawpy.RawPy.open_file
File "rawpy/_rawpy.pyx", line 668, in rawpy._rawpy.RawPy.handle_error
rawpy._rawpy.LibRawFatalError: Input/output error
imageConversion.py
path = '/Users/Account/Desktop/ORFImages'
for (dirpath, dirnames, filenames) in walk(path):
for l in filenames:
fullPath = str(join(dirpath,l))
with rawpy.imread(fullPath) as raw: #ERROR OCCURS HERE
rgb = raw.postprocess()
imageio.imwrite('test.jpg', rgb)
There is most definitely an ORF image at the fullpath variable.
What am I doing wrong?
This code works for me.
Please note that the path should be relative to the .py file you have.
import glob
import rawpy
import imageio
path = "ORFImages/*orf"
for infile in glob.glob(path):
with rawpy.imread(infile) as raw:
rgb = raw.postprocess()
imageio.imwrite('test.jpg', rgb)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With