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

PNG images are always read as RGB(A) images #536

Closed
mayeut opened this issue Jul 17, 2015 · 5 comments
Closed

PNG images are always read as RGB(A) images #536

mayeut opened this issue Jul 17, 2015 · 5 comments
Labels
Milestone

Comments

@mayeut
Copy link
Collaborator

mayeut commented Jul 17, 2015

Even with grayscale images, PNG images are always read as color images

@szukw000
Copy link
Contributor

@mayeut , can you point to one or two of these PNG grayscale images?

winfried

@mayeut
Copy link
Collaborator Author

mayeut commented Jul 17, 2015

@szukw000 ,

Here you go, from png test suite 1st with an alpha channel (basn4a08), 2nd without (basn0g08).
basn4a08
basn0g08

It's clearly written in pngtoimage:

/* GRAY => RGB; GRAY_ALPHA => RGBA */
if(color_type == PNG_COLOR_TYPE_GRAY || color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
{
  png_set_gray_to_rgb(png);
  color_type = (color_type == PNG_COLOR_TYPE_GRAY? PNG_COLOR_TYPE_RGB:
                                                    PNG_COLOR_TYPE_RGB_ALPHA);
}

@mayeut
Copy link
Collaborator Author

mayeut commented Jul 17, 2015

@szukw000,

those images are from libpng-1.6.13/contrib/pngsuite

@szukw000
Copy link
Contributor

@mayeut ,
3 channels GRAY give GRAY, 3 channels COLOR give COLOR.

COLOR:
basn6a08.png
basn6a16.png
ftp0n2c08.png

GRAY:
basn4a08.png
basn0g08.png

winfried

@mayeut
Copy link
Collaborator Author

mayeut commented Jul 17, 2015

@szukw000 ,

There's no such thing as 3 channels grayscale image. It's a color image with R == G == B (or Y == Y, U == V ==0, ....). It still appears gray but should only get 1 channel, no need to compress 3 components (that are identical - if we forget about mct).
To be linked with #264

@mayeut mayeut changed the title PNG images are always read as color images PNG images are always read as RGB(A) images Jul 17, 2015
mayeut added a commit to mayeut/openjpeg-data that referenced this issue Jul 19, 2015
mayeut added a commit to mayeut/openjpeg that referenced this issue Jul 19, 2015
Only input modified for now
Update uclouvain#536
Update uclouvain#264
@mayeut mayeut closed this as completed in fd1f7cf Jul 19, 2015
@mayeut mayeut added this to the OPJ v2.1.1 milestone Jul 26, 2015
@mayeut mayeut added the bug label Sep 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants