[OpenJDK 2D-Dev] [10] RFR: JDK-8164971: PNG metadata does not handle ImageCreationTime

Brian Burkhalter brian.burkhalter at oracle.com
Wed Jun 7 22:50:03 UTC 2017

Hi Jay,

On Jun 7, 2017, at 3:42 AM, Jayathirth D V <jayathirth.d.v at oracle.com> wrote:

> As per PNG Specification for text chunks http://libpng.org/pub/png/spec/1.2/PNG-Chunks.html#C.Anc-text . There can be multiple chunks with same keyword.

Yep: "Any number of text chunks can appear, and more than one with the same keyword is permissible."

> 1) In PNGMetadata. extractCreationTimeFromText() you are updating the "creation_time_present" to false when it doesn't follow RFC1123. So if there are multiple text chunks and if the latest chunk doesn't follow RFC1123 while decoding it will result in "creation_time_present" to be false. In case where we are not able to decode the provided text, we should not update "creation_time_present" to false.

I have not looked at the code but what I am wondering about is how it handles this part of the specification from the same section:

"For the Creation Time keyword, the date format defined in section 5.2.14 of RFC 1123 is suggested, but not required [RFC-1123]. Decoders should allow for free-format text associated with this or any other keyword.”  

Specifically the date format is *recommended* as opposed to be *required* to conform to RFC 1123. What happens if for example there is only one tEXt chunk which has a Creation Time in ISO 8601 format [1], e.g., "2017-06-07 15:50”?

If multiple Creation Time keywords are present the algorithm to decide which one to use as the ImageCreationTime in standard image metadata is somewhat arbitrary. One could for example use the value of the first one, the value of the last one, the oldest one, etc.

What examples of actual PNG “real world" files have been used for testing? For example ones from PngSuite [2] or those produced by typical user applications such as Apple’s “Preview” or the Windows program “IrfanView” [3] or other common image viewers?



[1] https://en.wikipedia.org/wiki/ISO_8601#Combined_date_and_time_representations
[2] http://www.schaik.com/pngsuite/pngsuite.html
[3] https://en.wikipedia.org/wiki/IrfanView
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/2d-dev/attachments/20170607/edcf5977/attachment.html>

More information about the 2d-dev mailing list