You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It works just fine when I run it from terminal, and it does extract the thumbnail image from the raw file.
But when I try to run it with pyexiftool, using this code:
from exiftool import ExifToolHelper
params = ["-b", "-ThumbnailImage", "raw_file.ARW", ">", "thumbnail_image.jpg"]
with ExifToolHelper() as et:
et.execute(*params)
I get the following error message (where line 6 is the last line of my code):
Traceback (most recent call last):
File "/Users/test_folder/simple_test.py", line 6, in <module>
et.execute(*params)
File "/Users/michelsabourin/.pyenv/versions/3.12.1/lib/python3.12/site-packages/exiftool/helper.py", line 131, in execute
result: Union[str, bytes] = super().execute(*str_bytes_params, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/michelsabourin/.pyenv/versions/3.12.1/lib/python3.12/site-packages/exiftool/exiftool.py", line 1067, in execute
raw_stdout = raw_stdout.decode(self._encoding)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte
I searched Internet for a solution and found many mentions of this error message, but could not figure out how they would apply to my problem.
I did however manage to find out the encoding of my raw file using this bit of code (don't know if it helps):
import chardet
with open("raw_file.ARW", "rb") as rawdata:
result = chardet.detect(rawdata.read(10000))
print(result)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi,
I'm trying to run the following exiftool command to extract a thumbnail image of a raw photo file, using pyexiftool:
exiftool -b -ThumbnailImage raw_image.ARW > thumbnail_image.jpg
It works just fine when I run it from terminal, and it does extract the thumbnail image from the raw file.
But when I try to run it with pyexiftool, using this code:
I get the following error message (where line 6 is the last line of my code):
I searched Internet for a solution and found many mentions of this error message, but could not figure out how they would apply to my problem.
I did however manage to find out the encoding of my raw file using this bit of code (don't know if it helps):
{'encoding': 'MacRoman', 'confidence': 0.6785735165156387, 'language': ''}
I'm running:
PyExifTool version: 0.5.6
exiftool version 12.70
Python version 3.12.1
Can somebody help me, please?
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions