String s = niso.getMimeType (); if (s != null) { _writer.println (margn2 + "MIMEType: " + s); if ((s = niso.getByteOrder ()) != null) { _writer.println (margn2 + "ByteOrder: " + s); int n = niso.getCompressionScheme (); if (n != NisoImageMetadata.NULL) { _writer.println (margn2 + "CompressionScheme: " + if ((n = niso.getCompressionLevel ()) != NisoImageMetadata.NULL) { _writer.println (margn2 + "CompressionLevel: " + n); if ((n = niso.getColorSpace ()) != NisoImageMetadata.NULL) { _writer.println (margn2 + "ColorSpace: " + addIntegerValue (n, NisoImageMetadata.COLORSPACE, if ((s = niso.getProfileName ()) != null) { _writer.println (margn2 + "ProfileName: " + s); if ((s = niso.getProfileURL ()) != null) { _writer.println (margn2 + "ProfileURL: " + s); int [] iarray = niso.getYCbCrSubSampling (); if (iarray != null) { _writer.print (margn2 + "YCbCrSubSampling: " + iarray[0]); if ((n = niso.getYCbCrPositioning ()) != NisoImageMetadata.NULL) {
/** Set the initial Niso values from a default Niso object. * This doesn't attempt to be complete, but sets * the values which we know could have been set from the * JP2 header. */ public void setDefaultNiso (NisoImageMetadata dNiso) { _niso.setByteOrder(dNiso.getByteOrder ()); _niso.setMimeType (dNiso.getMimeType ()); _niso.setBitsPerSample (dNiso.getBitsPerSample ()); _niso.setImageLength (dNiso.getImageLength ()); _niso.setImageWidth (dNiso.getImageWidth ()); _niso.setSamplesPerPixel (dNiso.getSamplesPerPixel ()); _niso.setCompressionScheme (dNiso.getCompressionScheme ()); _niso.setYSamplingFrequency (dNiso.getYSamplingFrequency ()); _niso.setXSamplingFrequency (dNiso.getXSamplingFrequency ()); _niso.setSamplingFrequencyUnit (dNiso.getSamplingFrequencyUnit ()); }
if (niso.getImageWidth () == NisoImageMetadata.NULL || niso.getImageLength () == NisoImageMetadata.NULL || niso.getStripOffsets () == null || niso.getRowsPerStrip () == NisoImageMetadata.NULL || niso.getStripByteCounts () == null || niso.getXSamplingFrequency () == null || niso.getYSamplingFrequency () == null || niso.getColormapBitCodeValue () == null || niso.getColormapRedValue () == null || niso.getColormapGreenValue () == null || niso.getColormapBlueValue () == null) { return false; int[] bps = niso.getBitsPerSample (); if (bps == null || (bps[0] != 4 && bps[0] != 8)) { return false;
protected void extractExifNisoData(NisoImageMetadata exifData) { int NULL = NisoImageMetadata.NULL; // just a shorthand LOGGER.fine("Copying exif nisoImageMD to principal nisoImageMD"); if (exifData.getExifVersion() != null) { _niso.setExifVersion(exifData.getExifVersion()); if (exifData.getAutoFocus() != NULL) { _niso.setAutoFocus(exifData.getAutoFocus()); if (exifData.getBackLight() != NULL) { _niso.setBackLight(exifData.getBackLight()); if (exifData.getBrightness() != NULL) { _niso.setBrightness(exifData.getBrightness()); if (exifData.getColorTemp() != NULL) { _niso.setColorTemp(exifData.getColorTemp()); if (exifData.getDeviceSource() != null) { _niso.setDeviceSource(exifData.getDeviceSource()); if (exifData.getDigitalCameraManufacturer() != null) { _niso.setDigitalCameraManufacturer(exifData .getDigitalCameraManufacturer()); if (exifData.getDigitalCameraModelName() != null) { _niso.setDigitalCameraModelName(exifData.getDigitalCameraModelName()); if (exifData.getDigitalCameraModelNumber() != null) { _niso.setDigitalCameraModelNumber(exifData.getDigitalCameraModelNumber());
long ln; _writer.println (); if ((s = niso.getImageIdentifier ()) != null) { _writer.println (margn2 + "ImageIdentifier: " + s); if ((ln = niso.getFileSize ()) != NisoImageMetadata.NULL) { _writer.println (margn2 + "FileSize: " + ln); if ((s = niso.getMimeType()) != null) { _writer.println (margn2 + "FormatName: " + s); if ((s = niso.getByteOrder ()) != null) { int n = niso.getCompressionScheme (); if (n != NisoImageMetadata.NULL) { _writer.println (margn2 + "CompressionScheme: " + if ((n = niso.getCompressionLevel ()) != NisoImageMetadata.NULL) { _writer.println (margn2 + "CompressionLevel: " + n); if ((n = niso.getChecksumMethod ()) != NisoImageMetadata.NULL) { _writer.println (margn2 + "ChecksumMethod: " + addIntegerValue (n, NisoImageMetadata.CHECKSUM_METHOD, rawOutput)); if ((s = niso.getChecksumValue ()) != null) { _writer.println (margn2 + "ChecksumValue: " + s); if ((ln = niso.getImageWidth ()) != NisoImageMetadata.NULL) {
String s = niso.getSourceType (); if (s != null) { captureBuffer.append (margn3 + element ("mix:sourceType", s)); useCaptureBuffer = true; s = niso.getSourceID (); if (s != null) { captureBuffer.append (margn3 + elementStart ("mix:SourceID")); double d = niso.getSourceXDimension (); int n = niso.getSourceXDimensionUnit (); if (d != NisoImageMetadata.NILL || n != NisoImageMetadata.NULL) { d = niso.getSourceYDimension (); n = niso.getSourceYDimensionUnit (); if (d != NisoImageMetadata.NILL || n != NisoImageMetadata.NULL) { captureBuffer.append (margn4 + s = niso.getDateTimeCreated (); if (s != null) { genCapBuf.append (margn3 + element ("mix:dateTimeCreated", s) + s = niso.getImageProducer (); if (s != null) { genCapBuf.append (margn3 + element ("mix:imageProducer", s) + EOL); s = niso.getDeviceSource (); if (s != null) { genCapBuf.append (margn3 + element ("mix:captureDevice", s) +
String s = niso.getSourceType (); if (s != null) { _writer.println (margn3 + element ("mix:SourceType", s)); s = niso.getSourceID (); if (s != null) { _writer.println (margn3 + element ("mix:SourceID", s)); s = niso.getImageProducer (); if (s != null) { _writer.println (margn3 + element ("mix:ImageProducer", s)); (margn3 + elementStart ("mix:Host") + EOL); boolean useHostBuf = false; s = niso.getHostComputer (); if (s != null) { hostBuf.append (margn4 + element ("mix:HostComputer", s) + EOL); useHostBuf = true; s = niso.getOS (); if (s != null) { hostBuf.append (margn4 + element ("mix:OperatingSystem", s) + EOL); useHostBuf = true; s = niso.getOSVersion (); if (s != null) { hostBuf.append (margn4 + element ("mix:OSVersion", s) + EOL); s = niso.getDeviceSource ();
if (niso.getImageWidth () == NisoImageMetadata.NULL || niso.getImageLength () == NisoImageMetadata.NULL || niso.getBitsPerSample () == null || tifd.getImageDescription () == null || niso.getXSamplingFrequency () == null || niso.getYSamplingFrequency () == null || niso.getScannerManufacturer () == null || (niso.getScannerModelName () == null && niso.getScannerModelNumber () == null) || niso.getScanningSoftware() == null || tifd.getImageDescription () == null || tifd.getCopyright () == null || niso.getDateTimeCreated () == null || tifd.getDateTime () == null || tifd.getTIFFEPStandardID () == null) { if (!(niso.getStripOffsets () != null && niso.getRowsPerStrip () != NisoImageMetadata.NULL && niso.getStripByteCounts () != null) && !(niso.getTileWidth () != NisoImageMetadata.NULL && niso.getTileLength () != NisoImageMetadata.NULL && niso.getTileOffsets () != null && niso.getTileByteCounts () != null)) { return false; int pInterpretation = niso.getColorSpace (); if (!(pInterpretation == 1 || pInterpretation == 2 ||
int n = niso.getSamplingFrequencyPlane (); if (n != NisoImageMetadata.NULL) { smBuf.append (margn5 + element ("mix:SamplingFrequencyPlane", n = niso.getSamplingFrequencyUnit (); if (n != NisoImageMetadata.NULL) { smBuf.append (margn5 + element ("mix:SamplingFrequencyUnit", Rational r = niso.getXSamplingFrequency (); if (r != null) { smBuf.append (margn5 + element ("mix:XSamplingFrequency", r = niso.getYSamplingFrequency (); if (r != null) { smBuf.append (margn5 + element ("mix:YSamplingFrequency", long ln = niso.getImageWidth (); if (ln != NisoImageMetadata.NULL) { smBuf.append (margn5 + element ("mix:ImageWidth", ln = niso.getImageLength (); if (ln != NisoImageMetadata.NULL) { smBuf.append (margn5 + element ("mix:ImageLength", double d = niso.getSourceXDimension (); n = niso.getSourceXDimensionUnit (); if (d != NisoImageMetadata.NILL || n != NisoImageMetadata.NULL) { smBuf.append (margn5 + elementStart ("mix:Source_X") + EOL);
_niso.setImageProducer (readASCII (count, value)); _niso.setBitsPerSample (readShortArray (type, count, value)); _niso.setBrightness (readSignedRational (count, value).toDouble ()); _niso.setBrightness (average (r[0], r[1]).toDouble ()); _niso.setColormapBitCodeValue (bitCode); _niso.setColormapRedValue (red); _niso.setColormapGreenValue (green); _niso.setColormapBlueValue (blue); checkCount (tag, count, 1); int scheme = readShort (type, count, value); _niso.setCompressionScheme (scheme); if (scheme == 5) { checkCount (tag, count, 20); _dateTime = readASCII (count, value); _niso.setDateTimeCreated (_dateTime); checkType (tag, type, ASCII); checkCount (tag, count, 20); _niso.setDateTimeCreated (readASCII (count, value)); checkType (tag, type, SRATIONAL); if (count == 1) {
(margn3 + elementStart ("mix:Format") + EOL); boolean useFBuf = false; // set to true if some data show up String s = niso.getMimeType (); if (s != null) { fBuf.append (margn4 + element ("mix:MIMEType", s) + EOL); useFBuf = true; if ((s = niso.getByteOrder ()) != null) { fBuf.append (margn4 + element ("mix:ByteOrder", s) + EOL); useFBuf = true; int comp = niso.getCompressionScheme (); int level = niso.getCompressionLevel (); if (comp != NisoImageMetadata.NULL || level != NisoImageMetadata.NULL) { fBuf.append (margn4 + elementStart ("mix:Compression") + EOL); (margn4 + elementStart ("mix:PhotometricInterpretation") + EOL); boolean usePIBuf = false; int n = niso.getColorSpace (); if (n != NisoImageMetadata.NULL) { piBuf.append (margn5 + element ("mix:ColorSpace", String s2= niso.getProfileURL (); if ((s = niso.getProfileName ()) != null || s2 != null) { piBuf.append (margn5 + elementStart ("mix:ICCProfile") + EOL); if (s != null) { int [] iarray = niso.getYCbCrSubSampling (); if (iarray != null) {
int n = niso.getSamplingFrequencyPlane(); if (n != NisoImageMetadata.NULL) { metricsBuf.append (margn4 + n = niso.getSamplingFrequencyUnit(); if (n != NisoImageMetadata.NULL) { final String sfu[] = {null, Rational r = niso.getXSamplingFrequency(); if (r != null) { rationalToString (metricsBuf, "mix:xSamplingFrequency", margn4, r); r = niso.getYSamplingFrequency(); if (r != null) { rationalToString (metricsBuf, "mix:ySamplingFrequency", margn4, r); int[] iarray = niso.getBitsPerSample(); if (iarray != null) { colorEncBuf.append (margn4 + elementStart ("mix:BitsPerSample") + n = niso.getSamplesPerPixel(); if (n != NisoImageMetadata.NULL) { colorEncBuf.append (margn4 + element ("mix:samplesPerPixel", iarray = niso.getExtraSamples(); if (iarray != null) { for (int ii = 0; ii < iarray.length; ii++) { String s = niso.getColormapReference();
if (niso.getImageWidth () == NisoImageMetadata.NULL || niso.getImageLength () == NisoImageMetadata.NULL || niso.getStripOffsets () == null || niso.getRowsPerStrip () == NisoImageMetadata.NULL || niso.getStripByteCounts () == null || niso.getXSamplingFrequency () == null || niso.getYSamplingFrequency () == null) { return false; int [] bps = niso.getBitsPerSample (); if (bps == null || bps.length < 3 || bps[0] != 8 || bps[1] != 8 || bps[2] != 8) { if (niso.getSamplesPerPixel () < 3) { return false;
int photometricInterpretation = niso.getColorSpace(); if (photometricInterpretation == NisoImageMetadata.NULL) { reportInvalid(MessageConstants.INF_PHO_NO_DEF, info); long imageWidth = niso.getImageWidth(); if (imageWidth == NisoImageMetadata.NULL) { reportInvalid(MessageConstants.INF_IMAGE_WID_NO_DEF, info); long imageLength = niso.getImageLength(); if (imageLength == NisoImageMetadata.NULL) { reportInvalid(MessageConstants.INF_IMAGE_WID_NO_DEF, info); long[] stripOffsets = niso.getStripOffsets(); long[] stripByteCounts = niso.getStripByteCounts(); boolean stripsDefined = (stripOffsets != null || stripByteCounts != null); long tileWidth = niso.getTileWidth(); long tileLength = niso.getTileLength(); long[] tileOffsets = niso.getTileOffsets(); long[] tileByteCounts = niso.getTileByteCounts(); boolean tilesDefined = (tileWidth != NisoImageMetadata.NULL || tileLength != NisoImageMetadata.NULL || tileOffsets != null || tileByteCounts != null); int planarConfiguration = niso.getPlanarConfiguration(); int samplesPerPixel = niso.getSamplesPerPixel(); int[] bitsPerSample = niso.getBitsPerSample(); if (photometricInterpretation == 4) { if (samplesPerPixel < 1 || bitsPerSample[0] != 1) {
long imageLength = niso.getImageLength (); if (imageLength == NisoImageMetadata.NULL || niso.getImageWidth () == NisoImageMetadata.NULL) { return false; boolean so = (niso.getStripOffsets () != null); boolean to = (niso.getTileOffsets () != null); if ((so && to) || (!so && !to)) { return false; if (niso.getStripByteCounts () == null) { return false; long rowsPerStrip = niso.getRowsPerStrip (); if (rowsPerStrip == NisoImageMetadata.NULL || rowsPerStrip < 1L || rowsPerStrip > imageLength) { if (niso.getTileWidth () == NisoImageMetadata.NULL || niso.getTileLength () == NisoImageMetadata.NULL || niso.getTileOffsets () == null || niso.getTileByteCounts () == null) { return false; int pi = niso.getColorSpace (); if (pi != 0 && pi != 1 && pi != 2 && pi != 3 && pi != 5 && pi != 8 && pi != 9) { int spp = niso.getSamplesPerPixel (); if (pi == 0 || pi == 1 || pi == 3) {
if (niso.getXSamplingFrequency () == null || niso.getYSamplingFrequency () == null) { return false; if (niso.getImageWidth () == NisoImageMetadata.NULL || niso.getImageLength () == NisoImageMetadata.NULL || niso.getStripOffsets () == null || niso.getRowsPerStrip () == NisoImageMetadata.NULL || niso.getStripByteCounts () == null) { return false; if (niso.getSamplesPerPixel () != 3) { return false; int[] bps = niso.getBitsPerSample (); if (bps == null || bps.length < 3 || bps[0] != 8 || bps[1] != 8 || bps[2] != 8) { return false; int pInterpretation = niso.getColorSpace (); if (!(pInterpretation == 2 || pInterpretation == 6)) { return false; if (niso.getYCbCrSubSampling () == null || niso.getYCbCrPositioning () == NisoImageMetadata.NULL) { return false;
(margn3 + elementStart ("mix:BasicImageCharacteristics") + EOL); boolean useBasCharBuf = false; long ln = niso.getImageWidth (); if (ln != NisoImageMetadata.NULL) { basCharBuf.append (margn4 + element ("mix:imageWidth", ln = niso.getImageLength (); if (ln != NisoImageMetadata.NULL) { basCharBuf.append (margn4 + element ("mix:imageHeight", (margn4 + elementStart ("mix:PhotometricInterpretation") + EOL); boolean usePIBuf = false; int n = niso.getColorSpace (); if (n != NisoImageMetadata.NULL) { piBuf.append (margn5 + element ("mix:colorSpace", String s = niso.getProfileName (); String s2= niso.getProfileURL (); if (s != null || s2 != null) { piBuf.append (margn5 + elementStart ("mix:ColorProfile") + EOL); int [] iarray = niso.getYCbCrSubSampling (); n = niso.getYCbCrPositioning (); Rational [] rarray = niso.getYCbCrCoefficients (); if (iarray != null || n != NisoImageMetadata.NULL || rarray != null) { piBuf.append (margn5 + elementStart ("mix:YCbCr") + EOL); rarray = niso.getReferenceBlackWhite (); if (rarray != null) {
if (niso.getImageLength () == NisoImageMetadata.NULL || niso.getStripOffsets () == null || niso.getImageWidth () == NisoImageMetadata.NULL || niso.getBitsPerSample () == null || niso.getColorSpace () == NisoImageMetadata.NULL || niso.getCompressionScheme () == NisoImageMetadata.NULL || niso.getXSamplingFrequency () == null || niso.getYSamplingFrequency () == null || ifd.getNewSubfileType () == IFD.NULL || ifd.getPageNumber () == null) { if (niso.getCompressionScheme () == 3) { if (ifd.getT4Options () == IFD.NULL) { return false;
boolean useObjIDBuf = false; objIDBuf.append (margn4 + element ("mix:objectIdentifierType", "JHOVE") + EOL); String s = niso.getImageIdentifier (); if (s != null) { objIDBuf.append (margn4 + element ("mix:objectIdentifierValue", s) + EOL); _writer.print (objIDBuf.toString ()); long ln = niso.getFileSize(); if (ln != NisoImageMetadata.NULL) { _writer.print (margn4 + element ("mix:fileSize", if ((s = niso.getByteOrder ()) != null) { int comp = niso.getCompressionScheme (); int level = niso.getCompressionLevel (); if (comp != NisoImageMetadata.NULL || level != NisoImageMetadata.NULL) { _writer.print (margn4 + elementStart ("mix:Compression") + EOL); int n = niso.getChecksumMethod (); s = niso.getChecksumValue (); if (n != NisoImageMetadata.NULL || s != null) { _writer.print (margn4 + elementStart ("mix:Fixity") + EOL);
int[] bps = niso.getBitsPerSample (); if (bps[0] != 1) { return false; if (niso.getStripOffsets().length > 1) { int resUnit = niso.getSamplingFrequencyUnit(); if (resUnit != 2 && resUnit != NisoImageMetadata.NULL) { return false; if (niso.getCompressionScheme() != 3) { return false; return false; if (niso.getImageWidth () != 1728) { return false; if (niso.getSamplesPerPixel () != 1) { return false; long xRes = niso.getXSamplingFrequency ().toLong(); long yRes = niso.getYSamplingFrequency ().toLong();