Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_Exception (Exception: Codec failed to produce an image, possibly due to invalid image data.) #709

Open
stephane-archer opened this issue Jan 7, 2025 · 6 comments

Comments

@stephane-archer
Copy link

DaVinci-Resolve-Logo.tif.zip

try to decode this tiff
_Exception (Exception: Codec failed to produce an image, possibly due to invalid image data.)

@brendan-duncan
Copy link
Owner

I'll take a look at it this evening (my time). The exception isn't from this library though.
My guess (without looking at the image yet) is that it's another 16-bit image, and you're trying to display it with flutter or something like that, which doesn't do 16-bit images. Try converting it to 8-bit first.

@stephane-archer
Copy link
Author

stephane-archer commented Jan 7, 2025

@brendan-duncan sorry I thought it was from this library when decoding the image.
With the “async gap” I wasn't able to see who through it.

It's another strange image file, I’m not sure of the bit-depth.

Photographers have quite complex needs regarding image format

@brendan-duncan
Copy link
Owner

Taking a quick look while my work code is compiling, the TIFF is 8-bit CMYK. That should be fine. But it's definitely not decoding correctly. Maybe some weird TIFF configuration not being handled correctly. I also see the conversion from CMYK to RGB is allocating an array each call, which will accumulate garbage collection, so I'll clean that up too while I'm in there looking into things.

@brendan-duncan
Copy link
Owner

Part of the problem (or the main problem) is the image is a 5-channel CMYK. I'm not entirely sure what the 5th channel is, I assume alpha. The library just isn't doing a good job handling that scenario. I'll have to fix it up.

@brendan-duncan
Copy link
Owner

Should be fixed in git now, I have it handle 5-channel CMYK-alpha now and the image decoded for me.

@stephane-archer
Copy link
Author

@brendan-duncan you are the best! 💪

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants