[OpenJDK 2D-Dev]  RFR: JDK-8164971: PNG metadata does not handle ImageCreationTime
Prahalad Kumar Narayanan
prahalad.kumar.narayanan at oracle.com
Sat Apr 22 11:02:54 UTC 2017
Good day to you.
Request your time in reviewing a fix for the bug
. JDK-8164971 PNG metadata does not handle ImageCreationTime
. First, the PNGImageReader 's logic skips parsing of 'any' chunk once IDAT is found.
. Hence, if the ancilliary text chunks appear after IDAT chunk, they are not processed at all.
. Second, the parsing of text chunks does not check for 'Creation Time' keyword.
. As a result the image creation time is never retrieved from .png image.
. The converse is true as well- While writing a png image, the creation time is not written to text chunk
Details on the Fix:
. Logic has been fixed to continue parsing chunks until IEND chunk is found
. Methods that process text chunks now check for the presence of 'Creation Time' and retrieve the time information.
. New methods and variables to support image creation time in metadata.
. Proper use of DateTimeFormatter.RFC_1123_DATE_TIME to decode time from text chunk and encode time to text as well.
. Changes to existing methods (that allow node retrieval & merge) for reading and updating creation time.
. Test Case & Test Image
. The test case- PngCreationTimeTest, checks the following use-cases
. Decoding creation time from duke.png 's text chunk.
. I created the image using gimp and added text chunk programmatically with Creation Time in it
. Updating the image creation time using- mergeTree (nativeTree) and inspecting same value in standard Document node
. Updating the image creation time using- mergeTree (standardTree) and inspecting same value in native tree's text entry.
. The changes were tested with Jtreg and JCK suites
. No regressions were seen.
Kindly review the changes at your convenience and provide your suggestions.
Thank you for your time in review
Have a good day
More information about the 2d-dev