audittool/test-lib/src/main/java/io/bdrc/audit/audittests/ImageAttributeTests.java
private String validate(final ImageAttributes imageAttributes) {
            boolean failed = false;
            StringBuilder failedReasons = new StringBuilder();

            if (imageAttributes.ImageFileFormat.equals(ImageAttributes.FILE_TIFF)) {

                // Test mode: 1 bit/pixel, image type num one of the
                // BufferedImage.ImageType enums
                InternalImageAtts itas = imageAttributes.InternalImageAtts;

                // We only care about non-monochrome files
                if (itas.BitDepth == 1) {
                    if (!(itas.ImageTypeNum == BufferedImage.TYPE_BYTE_GRAY ||
                            itas.ImageTypeNum == BufferedImage.TYPE_BYTE_BINARY ||
                            itas.ImageTypeNum == BufferedImage.TYPE_USHORT_GRAY)) {
                        failed = true;
                        failedReasons.append("binarytif");
                    }

                    if (!(imageAttributes.InternalImageAtts.IsGroup4Compression())) {
                        String pluralString = "";
                        if (failed) {
                            pluralString = "-";
                        }
                        failedReasons.append(String.format("%stiffnotgroup4 :%s", pluralString,
                                String.format("bd:%d:\titn :%d:\tcomp :%s:",
                                        itas.BitDepth,
                                        itas.ImageTypeNum,
                                        imageAttributes.InternalImageAtts
                                                .Compression)));
                    }
                }
            }
            return failedReasons.toString();
        }
/**
         * Validate normalized image statistics
         * if format is "TIFF"
         * - Compression must be "CCITT T6" ( group 4) or "CCITT T.6" (libraries are inconsistent)
         * - ImageTypeNum must be BufferedImage.TYPE_BYTE_BINARY
         * for all files:
         * - validate either there's no rotation data, or the rotation is
         * bit is '1' (for straight up)
         * <p>
         * If TIFF, image must be Group4 compression and "binary"
         *
         * @param imageAttributes collected image statistics from reader
         */


@param imageAttributes collected image statistics from reader
@param imageAttributes collected image statistics from reader
private String validate(final ImageAttributes imageAttributes) {
            boolean failed = false;
            StringBuilder failedReasons = new StringBuilder();
            if (imageAttributes.ImageFileFormat.equals(ImageAttributes.FILE_TIFF)) {
                InternalImageAtts itas = imageAttributes.InternalImageAtts;
                if (itas.BitDepth == 1) {
                    if (!(itas.ImageTypeNum == BufferedImage.TYPE_BYTE_GRAY ||
                            itas.ImageTypeNum == BufferedImage.TYPE_BYTE_BINARY ||
                            itas.ImageTypeNum == BufferedImage.TYPE_USHORT_GRAY)) {
                        failed = true;
                        failedReasons.append("binarytif");
                    }
                    if (!(imageAttributes.InternalImageAtts.IsGroup4Compression())) {
                        String pluralString = "";
                        if (failed) {
                            pluralString = "-";
                        }
                        failedReasons.append(String.format("%stiffnotgroup4 :%s", pluralString,
                                String.format("bd:%d:\titn :%d:\tcomp :%s:",
                                        itas.BitDepth,
                                        itas.ImageTypeNum,
                                        imageAttributes.InternalImageAtts
                                                .Compression)));
                    }
                }
            }
            return failedReasons.toString();
        }
private String validate ( final ImageAttributes imageAttributes ) { boolean failed = false ; StringBuilder failedReasons = new StringBuilder ( ) ; if ( imageAttributes . ImageFileFormat . equals ( ImageAttributes . FILE_TIFF ) ) { InternalImageAtts itas = imageAttributes . InternalImageAtts ; if ( itas . BitDepth == 1 ) { if ( ! ( itas . ImageTypeNum == BufferedImage . TYPE_BYTE_GRAY || itas . ImageTypeNum == BufferedImage . TYPE_BYTE_BINARY || itas . ImageTypeNum == BufferedImage . TYPE_USHORT_GRAY ) ) { failed = true ; failedReasons . append ( "binarytif" ) ; } if ( ! ( imageAttributes . InternalImageAtts . IsGroup4Compression ( ) ) ) { String pluralString = "" ; if ( failed ) { pluralString = "-" ; } failedReasons . append ( String . format ( "%stiffnotgroup4 :%s" , pluralString , String . format ( "bd:%d:\titn :%d:\tcomp :%s:" , itas . BitDepth , itas . ImageTypeNum , imageAttributes . InternalImageAtts . Compression ) ) ) ; } } } return failedReasons . toString ( ) ; }
Validate normalized image statistics
 if format is "TIFF"
 - Compression must be "CCITT T6" ( group 4) or "CCITT T.6" (libraries are inconsistent)
 - ImageTypeNum must be BufferedImage.TYPE_BYTE_BINARY
 for all files:
 - validate either there's no rotation data, or the rotation is
 bit is '1' (for straight up)
 <p>
 If TIFF, image must be Group4 compression and "binary"
Validate normalized image statistics if format is " TIFF " - Compression must be " CCITT T6 " ( group 4 ) or " CCITT T . 6 " ( libraries are inconsistent ) - ImageTypeNum must be BufferedImage . TYPE_BYTE_BINARY for all files : - validate either there ' s no rotation data or the rotation is bit is ' 1 ' ( for straight up ) <p > If TIFF image must be Group4 compression and " binary "
// Test mode: 1 bit/pixel, image type num one of the // BufferedImage.ImageType enums // We only care about non-monochrome files