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
{{ message }}
Repository navigation
can't save screen: PIL.UnidentifiedImageError: cannot identify image file <_io.BytesIO object at 0x04031C58> #17
whenever i try to save a screenshot it raise pillow unidentify io_byte(as show in the picture)
I already try to reinstall pillow and set DISPLAY_DATA_BYTES to 1152000 but still didn't work
The issue seems that in case of 800x480 scopes the PNG file is truncated even if you set DISPLAY_DATA_BYTES to 1152000 (= 800x480x3).
Adding from PIL import ImageFile ImageFile.LOAD_TRUNCATED_IMAGES = True
after the block with from PIL import Image, ImageOps, ImageEnhance
in cli.py seems to solve it as a workaround but the real issue is obviously somewhere else and needs to be fixed there.
Activity
B-G-T commentedon Nov 1, 2020
The issue seems that in case of 800x480 scopes the PNG file is truncated even if you set DISPLAY_DATA_BYTES to 1152000 (= 800x480x3).
Adding
from PIL import ImageFileImageFile.LOAD_TRUNCATED_IMAGES = Trueafter the block with
from PIL import Image, ImageOps, ImageEnhancein cli.py seems to solve it as a workaround but the real issue is obviously somewhere else and needs to be fixed there.
fix pklaus#17
ornea commentedon Apr 12, 2026
I have similar issues using ds1054z scope ver 00.04.03.SP2
from PIL import ImageTk, Image...
img_data = self.scope.display_dataimg = Image.open(io.BytesIO(img_data))<- this fails as does saving the file first then trying toimg = Image.open(filename)The workarounds above from B-G-T did not work for me but if I change the following line in init ~line no 627
self.write(":DISPlay:DATA? ON,OFF,PNG") to self.write(":DISPlay:DATA? ON,OFF,JPEG")it fixes my issues
i can see in history that it was once
self.write(":DISPlay:DATA? ON,OFF,BMP24")