private void CheckYCbCr ( IfdTags metadata , int n ) { // Samples per pixel if ( ! metadata . containsTagId ( TiffTags . getTagId ( "SamplesPerPixel" ) ) ) { validation . addErrorLoc ( "Missing Samples Per Pixel" , "IFD" + n ) ; } else { long spp = metadata . get ( TiffTags . getTagId ( "SamplesPerPixel" ) ) . getFirstNumericValue ( ) ; if ( spp != 3 ) { validation . addError ( "Invalid Samples Per Pixel" , "IFD" + n , spp ) ; } } // BitsPerSample if ( ! metadata . containsTagId ( TiffTags . getTagId ( "BitsPerSample" ) ) ) { validation . addErrorLoc ( "Missing BitsPerSample" , "IFD" + n ) ; } else { for ( abstractTiffType vi : metadata . get ( TiffTags . getTagId ( "BitsPerSample" ) ) . getValue ( ) ) { if ( vi . toInt ( ) != 8 ) { validation . addError ( "Invalid BitsPerSample" , "IFD" + n , vi . toInt ( ) ) ; break ; } } } // Compression // long comp = metadata.get(TiffTags.getTagId("Compression")).getFirstNumericValue(); // if (comp != 1 && comp != 5 && comp != 6) // validation.addError("Invalid Compression", comp); // if (!metadata.containsTagId(TiffTags.getTagId("ReferenceBlackWhite"))) // validation.addError("Missing ReferenceBlackWhite"); // if (!metadata.containsTagId(TiffTags.getTagId("YCbCrCoefficients"))) // validation.addError("Missing YCbCr Coefficients"); // if (!metadata.containsTagId(TiffTags.getTagId("YCbCrSubSampling"))) // validation.addError("Missing YCbCr SubSampling"); // if (!metadata.containsTagId(TiffTags.getTagId("YCbCrPositioning"))) // validation.addError("Missing YCbCr Positioning"); }
Check YCbCr .