saschiwy / HeicConverter

A very simple command line tool to convert heic files to jpg
MIT License
146 stars 21 forks source link

Set ALLOW_INCORRECT_HEADERS to True #7

Closed TiTi closed 4 months ago

TiTi commented 6 months ago

Hello,

I've got some corrupted .heic and conversion is failing for them with this error:

Unable to convert /mnt/c/Users/TiTi/Downloads/heic/2-20230525_151210.heic: corrupted image(dimensions in header: (800, 360), decoded dimensions: (800, 357)). Set ALLOW_INCORRECT_HEADERS to True if you need to load them

I tried export ALLOW_INCORRECT_HEADERS=True with no success. I suppose this is a Pillow flag. I there a way to set it ?

Edit: in converter.py, i replaced register_heif_opener() with register_heif_opener(allow_incorrect_headers=True) + recompile and it worked like a charm

saschiwy commented 4 months ago

Closed with 1c028af5385f91556ea374290f534c23357381d3