RFR: 8160327: Support for thumbnails present in APP1 marker for JPEG [v7]

Brian Burkhalter bpb at openjdk.org
Mon Mar 3 19:27:01 UTC 2025


On Wed, 26 Feb 2025 09:23:47 GMT, Jeremy <duke at openjdk.org> wrote:

>> This adds support for parsing thumbnails in an APP1 Exif marker.
>> 
>> This builds on an unfinished proposal by Brian Burkhalter (around 2016). In that previous work the only additional meta info he parsed was the image creation time; this PR similarly includes the same property. (I can't speak to why he included that property, but it looks like he has a lot of experience with ImageIO so I trust his judgment.)
>> 
>> ~~The test addresses the original images attached to the ticket plus a few extra images I found on my computer that include unusual properties. (Possibly those images are malformed, but if they exist in the wild and other platforms support them then I'd prefer to support them too.)~~
>> 
>> The images used in this test are contributed by Brian and me.
>
> Jeremy has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8160327: trying to placate PR script
>   
>   The github script still classifies two of the sample jpgs as executable files, which it classifies as errors.

I think we need to add something to the specification, for example:


--- a/src/java.desktop/share/classes/javax/imageio/metadata/doc-files/jpeg_metadata.html
+++ b/src/java.desktop/share/classes/javax/imageio/metadata/doc-files/jpeg_metadata.html
@@ -509,6 +509,17 @@ <h2>
 <h2>
 <a id=thumbs>Thumbnail Images</a>
 </h2>
+<h3>
+Reading Thumbnail Images
+</h3>
+Thumbnail images are read from JFIF, JFIF extension, and Exif marker segments.
+One or more thumbnails may be present in the JFIF segment(s), but at most one
+will be present in the Exif segment. As specified, JFIF and Exif marker segments
+should be mutually exclusive, but if they are both present, then any JFIF
+thumbnail(s) will precede any Exif thumbnail.
+<h3>
+Writing Thumbnail Images
+</h3>
 Thumbnails are supported by the use of JFIF and JFIF extension marker segments.
 Thumbnails provided on the write methods determine the thumbnails that will be
 included.  <code>app0JFIF</code> and <code>app0JFXX</code> nodes present in


If this is agreeable, I can file a matching CSR.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/22898#issuecomment-2695336992


More information about the client-libs-dev mailing list