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

Jeremy duke at openjdk.org
Mon Feb 24 07:11:55 UTC 2025


On Mon, 24 Feb 2025 05:48:51 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: replacing the "sony-d700" image
>   
>   The origins of that image were unknown, so we weren't sure if we had the rights to store it in the OpenJDK repo.
>   
>   I couldn't figure out how to create this kind of uncompressed thumbnail from an image editing app, so I spliced this new file together manually in a hex editor using the sony-d700 image as a blueprint.

I think I've finished all the pending edits I had in mind. 

Regarding ownership of images:
One sample image comes from Brian, the rest come from me.

A few questions remain on my end:

1. The PR bot somehow flagged two of the test jpg files as executables (which it describes as "Errors"). Any recommendations on how to placate this error? (Should I just zip the images together?)

@bplb :
2. Do you still think a test case featuring an uncompressed RGB main image with a uncompressed RGB thumbnail is necessary?

I'm not sure off the top of my head how to generate this kind of image. It seems to me like reading any thumbnail is completely insulated from reading the main image, so mixing and matching combinations of main images and thumbnails shouldn't be an issue. (?)

3. Should I add a test that includes an EXIF thumbnail followed by a JFIF thumbnail? You asked about (and the original ticket included) an image that featured a JFIF thumbnail followed by an EXIF thumbnail, and this PR now covers that test case. But I think the JFIF logic is stricter and will probably throw an exception if the EXIF thumbnail appears first.

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

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


More information about the client-libs-dev mailing list