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

SamplesPerPixel broken when header.ColorType = ColorType.PaletteUsed | ColorType.ColorUsed #13

Open
earok opened this issue Jun 29, 2023 · 1 comment

Comments

@earok
Copy link

earok commented Jun 29, 2023

SamplesPerPixel seems to return 0 on at least some 256 color images, resulting in some of the lines having incorrect filter applied.

Suggested fix might be adding a case for "case ColorType.PaletteUsed | ColorType.ColorUsed":

		switch (header.ColorType)
		{
			case ColorType.None:
				return 1;

			case ColorType.PaletteUsed | ColorType.ColorUsed:
			case ColorType.PaletteUsed:
				return 1;

			case ColorType.ColorUsed:
				return 3;
			case ColorType.AlphaChannelUsed:
				return 2;
			case ColorType.ColorUsed | ColorType.AlphaChannelUsed:
				return 4;
			default:
				return 0;
		}
@ThomasHoevel
Copy link

logo.zip

The attached image uses the flags ColorType.PaletteUsed | ColorType.ColorUsed, but still cannot be opened with the fix given above.
It seems that "data" would have to have twice as many bytes as there actually are.

Any help to get BigGustave read this image file will be appreciated.
I don't know where that image originally came from.

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