question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot extract clipping path from JPEG with multiple APP13 segments

See original GitHub issue

Cannot 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:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
aerpenbeckcommented, Feb 10, 2021

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.

1reaction
haraldkcommented, Feb 26, 2021

The fix is part of the 3.6.3 release out now! 😀

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found