pklaus / ds1054z

Python package for the Rigol DS1054Z Oscilloscope
https://ds1054z.readthedocs.org/
178 stars 40 forks source link

can't save screen: PIL.UnidentifiedImageError: cannot identify image file <_io.BytesIO object at 0x04031C58> #17

Open isarafx opened 3 years ago

isarafx commented 3 years ago

ภาพ 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

B-G-T commented 3 years ago

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.