0

I have a new requirement within my application. All images needs to be in RGB format (no CMYK) and the subsampling should be deactivated. I have managed to check the CMYK check, but struggling with the subsampling requirement.

Now I have to implement a method like this:

private bool IsSubsamplingActivated(byte[] imageContent) 
{
    // code goes here
}

Unfortunately I really don't know how to solve that issue :-( Could you guys give me a hint how to solve this? External library? Some dotNET classes?

SergejK
  • 59
  • 1
  • 8
  • The simplest way would be to walk the chain of JPEG markers until you hit the SOF (start of frame = FFC0->FFC3). In that marker is the information on color subsampling. – BitBank Feb 19 '16 at 20:46

1 Answers1

0

1) A color JPEG is almost always in YCbCr format.

2) If you want to check to see if the image uses subsampling, you need to scan for an SOF marker (there are several types). The sampling values are in that market. If the X sampling values for all scans are the same and the y sampling values are all the same, there is no sub sampling.

user3344003
  • 20,574
  • 3
  • 26
  • 62
  • Unfortunately it is not in YVbCr format, but the subsampling is activated. I will try to analyze the marker and compare the x and y values with each other. Thanks so far. – SergejK Feb 24 '16 at 10:52