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 loader: attach palette bit depth, if any, as metadata #1199

Merged
merged 1 commit into from Jan 1, 2019

Conversation

lovell
Copy link
Member

@lovell lovell commented Jan 1, 2019

Hello, this is a small addition to the PNG header reader to attach the bit depth of the palette, if any, as metadata.

By way of example, using test images from http://www.schaik.com/pngsuite/pngsuite_bas_png.html we can now differentiate 4-bit vs 8-bit palette:

$ vipsheader -a basn3p04.png
basn3p04.png: 32x32 uchar, 3 bands, srgb, pngload
width: 32
height: 32
bands: 3
format: uchar
coding: none
interpretation: srgb
xoffset: 0
yoffset: 0
xres: 2.834
yres: 2.834
filename: basn3p04.png
vips-loader: pngload
palette-bit-depth: 4
$ vipsheader -a basn3p08.png
basn3p08.png: 32x32 uchar, 3 bands, srgb, pngload
width: 32
height: 32
bands: 3
format: uchar
coding: none
interpretation: srgb
xoffset: 0
yoffset: 0
xres: 2.834
yres: 2.834
filename: basn3p08.png
vips-loader: pngload
palette-bit-depth: 8

These two images would otherwise be indistinguishable using metadata alone.

@jcupitt jcupitt merged commit 2b8db2e into libvips:master Jan 1, 2019
@jcupitt
Copy link
Member

jcupitt commented Jan 1, 2019

OK, looks reasonable.

@lovell lovell deleted the png-header-palette-bit-depth branch January 1, 2019 20:35
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

Successfully merging this pull request may close these issues.

None yet

2 participants