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

Fails to decode tga image with "Image is too large" error #1834

Open
FredrikNoren opened this issue Dec 12, 2022 · 2 comments
Open

Fails to decode tga image with "Image is too large" error #1834

FredrikNoren opened this issue Dec 12, 2022 · 2 comments

Comments

@FredrikNoren
Copy link

Expected

The image I've attached should load

Actual behaviour

I'm getting an error: "Image is too large"

Reproduction steps

Simply load the attached image with image.

Crossbow_Ao.tga.zip

@fintelia
Copy link
Contributor

The error is being triggered here:

if pixel_data.len() != buf.len() {
return Err(ImageError::Limits(LimitError::from_kind(
LimitErrorKind::DimensionError,
)));
}

pixel_data.len() = 3 * 4096 * 4096 and buf.len() = 4 * 4096 * 4096.

@fintelia
Copy link
Contributor

Ok, the issue seems to be that the image header has Image Descriptor Byte set to 8, but the color map itself only contains RGB data. This source claims that "This entire byte should be set to 0" for color mapped data, but I'm not sure that's the authoritative spec. Perhaps the right thing is actually just to ignore that byte for color mapped images and just derive the presence of an alpha channel from the number of bytes per color map entry?

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