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

Add test for three color types of PNG with tRNS chunk #125

Merged
merged 1 commit into from Aug 7, 2019

Conversation

mloskot
Copy link
Member

@mloskot mloskot commented Jul 31, 2018

The tests cover issue #117 and pull request #118, extending the coverage
for all color types that may have tRNS chunks:

  • color type 0 (grayscale), the tRNS chunk contains a single gray level
  • color type 2 (truecolor), the tRNS chunk contains a single RGB color
  • color type 3 (indexed color), the tRNS chunk contains a series of
    one-byte alpha values

Add sample PNG files from the "official" test-suite for PNG created by Willem van Schaik.

Add <define>BOOST_GIL_IO_TEST_ALLOW_READING_IMAGES to Jamfile for PNG tests.
NOTE: Deliberately not defined BOOST_GIL_IO_TEST_ALLOW_WRITING_IMAGES as it seems to require some extra configuration, currently it causes some tests to fail. So, Jamfile likely needs more updates and clean-up.

References

Tasklist

  • Find a good PNG test image with tRNS chunk
  • Complete the test to verify tRNS has been read and used as expected
  • Review
  • All CI builds and checks have passed

@mloskot mloskot added the ext/io boost/gil/extension/io/ label Jul 31, 2018
@mloskot mloskot force-pushed the ml/gh120/add-test-for-grayalpha branch from bc501a1 to 15d84c8 Compare July 31, 2018 17:13
@mloskot mloskot force-pushed the ml/gh120/add-test-for-grayalpha branch from 15d84c8 to a4b1d3d Compare September 25, 2018 11:54
@adrianbroher adrianbroher mentioned this pull request Sep 25, 2018
6 tasks
@mloskot mloskot changed the title WIP: Add test for gray alpha based on tRNS chunk [ci skip] Add test for gray alpha based on tRNS chunk Sep 25, 2018
@chhenning
Copy link
Contributor

Is the image read correctly?

@mloskot
Copy link
Member Author

mloskot commented Sep 25, 2018

@chhenning It is read successfully, without any exception about incompatibility. It also causes reading of the tRNS chunks, then setting png_set_tRNS_to_alpha.

That is all I observe. I haven't tried to verify if the image is read correctly.

@mloskot mloskot force-pushed the ml/gh120/add-test-for-grayalpha branch from a4b1d3d to a08f30d Compare September 25, 2018 14:33
@mloskot
Copy link
Member Author

mloskot commented Sep 25, 2018

NOTE: None of the CI builds run the full IO tests, but the simple, hence this added read_alpha_palette_with_trns_chunk test is not checked on our CI-s.

@mloskot
Copy link
Member Author

mloskot commented Oct 3, 2018

@stefanseefeld & @chhenning any feedback on this one?

@mloskot mloskot force-pushed the ml/gh120/add-test-for-grayalpha branch from a08f30d to 9b20f61 Compare October 23, 2018 20:05
@mloskot mloskot added the status/need-feedback Asking for more details about the problem label Dec 17, 2018
@mloskot mloskot added the test New tests development or missing tests issues, no new functionality label Jan 19, 2019
@mloskot mloskot force-pushed the ml/gh120/add-test-for-grayalpha branch from 9b20f61 to 82b471c Compare January 27, 2019 00:45
@mloskot
Copy link
Member Author

mloskot commented Jul 16, 2019

In order to properly test tRNS support, we may need three different images:

From http://www.libpng.org/pub/png/spec/1.2/PNG-Chunks.html:

The tRNS chunk specifies that the image uses simple transparency: either alpha values associated with palette entries (for indexed-color images) or a single transparent color (for grayscale and truecolor images).

For color type 3 (indexed color), the tRNS chunk contains a series of one-byte alpha values, corresponding to entries in the PLTE chunk:

Alpha for palette index 0:  1 byte
Alpha for palette index 1:  1 byte
...etc...

For color type 0 (grayscale), the tRNS chunk contains a single gray level value, stored in the format:

Gray:  2 bytes, range 0 .. (2^bitdepth)-1

For color type 2 (truecolor), the tRNS chunk contains a single RGB color value, stored in the format:

Red:   2 bytes, range 0 .. (2^bitdepth)-1
Green: 2 bytes, range 0 .. (2^bitdepth)-1
Blue:  2 bytes, range 0 .. (2^bitdepth)-1

@mloskot mloskot force-pushed the ml/gh120/add-test-for-grayalpha branch from 82b471c to 8d6d783 Compare July 16, 2019 20:02
@mloskot mloskot changed the title Add test for gray alpha based on tRNS chunk Add test for three color types of PNG with tRNS chunk Jul 18, 2019
@mloskot mloskot force-pushed the ml/gh120/add-test-for-grayalpha branch from 8d6d783 to 0b1da32 Compare July 18, 2019 18:49
@mloskot mloskot self-assigned this Jul 18, 2019
@mloskot mloskot removed the status/need-feedback Asking for more details about the problem label Jul 18, 2019
@mloskot mloskot force-pushed the ml/gh120/add-test-for-grayalpha branch from 0b1da32 to 4e6599e Compare July 18, 2019 19:38
The tests cover issue boostorg#117 and pull request boostorg#118, extending the coverage
for all color types that may have tRNS chunks:

  - color type 0 (grayscale), the tRNS chunk contains a single gray level
  - color type 2 (truecolor), the tRNS chunk contains a single RGB color
  - color type 3 (indexed color), the tRNS chunk contains a series of
    one-byte alpha values

Add sample PNG files from the "official" test-suite for PNG
created by Willem van Schaik.

Add <define>BOOST_GIL_IO_TEST_ALLOW_READING_IMAGES to Jamfile for PNG tests.
NOTE: Deliberately not defined BOOST_GIL_IO_TEST_ALLOW_WRITING_IMAGES
as it seems to require some extra configuration, currently it causes
some tests to fail. So, Jamfile likely needs more updates and clean-up.

Closes boostorg#120
@mloskot mloskot force-pushed the ml/gh120/add-test-for-grayalpha branch from 4e6599e to 01b02ee Compare July 23, 2019 19:37
@mloskot mloskot added this to the Boost 1.72+ milestone Aug 7, 2019
@mloskot
Copy link
Member Author

mloskot commented Aug 7, 2019

Following second round of research, #125 (comment) around a month ago, the test received collection of PNG files with the variety of tRNS.

Despite long time, no reviews have arrived, so I'm going to merge it.

@mloskot mloskot merged commit 2607795 into boostorg:develop Aug 7, 2019
@mloskot mloskot deleted the ml/gh120/add-test-for-grayalpha branch August 7, 2019 20:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ext/io boost/gil/extension/io/ test New tests development or missing tests issues, no new functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

How to add tests for PNG grayalpha fix in #118
2 participants