Cannot extract clipping path from JPEG with multiple APP13 segments
See original GitHub issueCannot extract clipping path from a JPEG file with multiple APP13/Photoshop 3.0 segments.
Here’s an example with 3 APP13 segments.
Using exiftool
I can verify that the file actually does contain clipping path information.
It’s probably related to this part of com.twelvemonkeys.imageio.path.Paths#readPath
where only the first segment is evaluated:
List<JPEGSegment> photoshop = JPEGSegmentUtil.readSegments(stream, segmentIdentifiers);
if (!photoshop.isEmpty()) {
return readPathFromPhotoshopResources(new MemoryCacheImageInputStream(photoshop.get(0).data()));
}
So for this file null
is returned because the path information is stored in another segment.
I’ve tried to work around this by processing all segments from the List but this fails with an exception in com.twelvemonkeys.imageio.metadata.psd.PSDReader#read
in the switch statement.
I think it might be possible to join the data from all segments into one but haven’t been successful in doing so.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Issue #1842: Load Clipping Path metadata from JPEGs (!756)
It allows the JPEG plug-in to recognize APP13 markers, which Photoshop uses to store clipping path information in PSD format.
Read more >Use clipping paths in InDesign - Adobe Support
Clipping paths crop part of the artwork so that only a portion of the artwork appears through the shape or shapes you create....
Read more >Save a Clipping Path inside a JPG in Photoshop - YouTube
Add a clipping path to a JPG image, then save as a... JPG. Not a PSD. Not a PNG. Yes, a JPG...seriously! Join...
Read more >TwelveMonkeys - Bountysource
Cannot extract clipping path from a JPEG file with multiple APP13/Photoshop 3.0 segments. Here's an example with 3 APP13 segments.
Read more >Why can a JPEG hold clipping path data but cannot use it ...
because when we add a clipping path (or any other data) to a JPG (or any other type of image file such as...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
There’s a similar issue in the Apache Commons Imaging project that has sample files with multiple APP13 segments attached, but those do not have a clipping path defined. Maybe those files could be useful for a test case though.
The fix is part of the 3.6.3 release out now! 😀