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.

Some YCbCr encoded JPEGs have ColorSpaceType "RGB" in the standard metadata

See original GitHub issue

The following test resources fail to report correct color space using the standard metadata: jpeg/exif-jpeg-thumbnail-sony-dsc-p150-inverted-colors.jpg, jpeg/exif-pspro-13-inverted-colors.jpg and jpeg/no-jfif-ycbcr.jpg. The first two are Exif files, the last one is not (might be two different issues).

Update: The first two reads correctly, while the last one has inverted colors using the standard JPEGImageReader. Seems the Exif segment presence makes the native code interpret color space correctly, even though the Java part does not (thus the incorrect value in the metadata).

The images are all non-subsampled, with component ids 1-3. That means they should be identified as YCbCr according to the metadata API doc:

If neither [JFIF or Adobe] marker segment is present […and the component count is 3 or 4…] the component ids are consulted. If these values are 1-3 for a 3-channel image, then the image is assumed to be YCbCr.

However, they are not…

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
haraldkcommented, Jul 10, 2020

Should be fixed now, via 5cc201b4.

0reactions
haraldkcommented, Dec 21, 2017

Seems the original JDK issue is actually fixed in Java 9: http://hg.openjdk.java.net/jdk9/jdk9/jdk/rev/06f9a2bff766

Read more comments on GitHub >

github_iconTop Results From Across the Web

JPEG Metadata Format Specification and Usage Notes
1 - The image is encoded as YCbCr (implicitly converted from RGB on encoding). 0 - Unknown. 3-channel images are assumed to be...
Read more >
haraldk/TwelveMonkeys twelvemonkeys-3.6 on GitHub
#108 Finally fixed the long standing issue of some YCbCr encoded JPEGs having ColorSpaceType "RGB" in the standard metadata. Check out latest releases...
Read more >
TIFF Metadata Format Specification and Usage Notes (Java SE 19 ...
Linear RGB if the image has three samples per pixel, has photometric type CIE L*a*b*, or has photometric type YCbCr and is not...
Read more >
Package io.scif.media.imageio.plugins.tiff - SciJava Javadoc
A color space created from the ICC Profile metadata field if it is present and compatible with the image data layout. sRGB if...
Read more >
YCbCr - Wikipedia
Y′CbCr color spaces are defined by a mathematical coordinate transformation from an associated RGB primaries and white point. If the underlying RGB color...
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