public String getValueDescription() { try { return getValueDescription(getValue()); } catch (ImageReadException e) { return "Invalid value: " + e.getMessage(); } }
public void dump(PrintWriter pw) { dump(pw, null); }
protected void fillInValues(ByteSource byteSource) throws ImageReadException, IOException { for (int i = 0; i < entries.size(); i++) { TiffField entry = (TiffField) entries.get(i); entry.fillInValue(byteSource); } }
public Item(TiffField entry) { // super(entry.getTagName() + " (" + entry.getFieldTypeName() + ")", super(entry.getTagName(), entry.getValueDescription()); this.entry = entry; }
public TiffField(int tag, int directoryType, int type, int Length, int ValueOffset, byte ValueOffsetBytes[], int byteOrder) { this.tag = tag; this.directoryType = directoryType; this.type = type; this.length = Length; this.valueOffset = ValueOffset; this.valueOffsetBytes = ValueOffsetBytes; this.byteOrder = byteOrder; fieldType = getFieldType(type); tagInfo = getTag(directoryType, tag); }
int height = heightField.getIntValue(); int width = widthField.getIntValue(); int resolutionUnit = 2; // Inch if ((resolutionUnitField != null) && (resolutionUnitField.getValue() != null)) resolutionUnit = resolutionUnitField.getIntValue(); && (xResolutionField.getValue() != null)) .getDoubleValue(); physicalWidthDpi = (int) (XResolutionPixelsPerUnit / unitsPerInch); physicalWidthInch = (float) (width / (XResolutionPixelsPerUnit * unitsPerInch)); && (yResolutionField.getValue() != null)) .getDoubleValue(); physicalHeightDpi = (int) (YResolutionPixelsPerUnit / unitsPerInch); physicalHeightInch = (float) (height / (YResolutionPixelsPerUnit * unitsPerInch)); && (bitsPerSampleField.getValue() != null)) bitsPerSample = bitsPerSampleField.getIntValueOrArraySum(); String comment = field.toString(); comments.add(comment); .getIntValue(); String compressionAlgorithm;
TiffField field = new TiffField(tag, dirType, type, length, valueOffset, valueOffsetBytes, getByteOrder()); field.setSortHint(i); field.fillInValue(byteSource); continue; int subDirectoryOffset = ((Number) entry.getValue()) .intValue(); int subDirectoryType;
public int getIntValue() throws ImageReadException { Object o = getValue(); if (o == null) throw new ImageReadException("Missing value: " + tagInfo.getDescription()); return ((Number) o).intValue(); }
String latitudeRef = latitudeRefField.getStringValue(); RationalNumber latitude[] = (RationalNumber[]) latitudeField.getValue(); String longitudeRef = longitudeRefField.getStringValue(); RationalNumber longitude[] = (RationalNumber[]) longitudeField .getValue();
Object value = srcField.getValue(); dstField.setSortHint(srcField.getSortHint()); dstDir.add(dstField);
public String toString() { StringBuffer result = new StringBuffer(); result.append(tag + " (0x" + Integer.toHexString(tag) + ": " + tagInfo.name + "): "); result.append(getValueDescription() + " (" + length + " " + fieldType.name + ")"); return result.toString(); }
.getIntArrayValue(); TIFF_TAG_YCBCR_COEFFICIENTS, true).getDoubleArrayValue(); TIFF_TAG_YCBCR_POSITIONING, true).getIntArrayValue(); int yCbCrSubSampling[] = directory.findField( TIFF_TAG_YCBCR_SUB_SAMPLING, true).getIntArrayValue(); TIFF_TAG_REFERENCE_BLACK_WHITE, true).getDoubleArrayValue();
public String getXmpXml(ByteSource byteSource, Map params) throws ImageReadException, IOException { FormatCompliance formatCompliance = FormatCompliance.getDefault(); TiffContents contents = new TiffReader(isStrict(params)) .readDirectories(byteSource, false, formatCompliance); TiffDirectory directory = (TiffDirectory) contents.directories.get(0); TiffField xmpField = directory.findField(TIFF_TAG_XMP, false); if (xmpField == null) return null; byte bytes[] = xmpField.getByteArrayValue(); try { // segment data is UTF-8 encoded xml. String xml = new String(bytes, "utf-8"); return xml; } catch (UnsupportedEncodingException e) { throw new ImageReadException("Invalid JPEG XMP Segment."); } }
Debug.debug("entry.type", entry.getDescriptionWithoutValue()); Debug.debug("entry.type", entry.fieldType); throw new ImageReadException("Text field not encoded as bytes.");
int height = heightField.getIntValue(); int width = widthField.getIntValue(); int resolutionUnit = 2; // Inch if ((resolutionUnitField != null) && (resolutionUnitField.getValue() != null)) resolutionUnit = resolutionUnitField.getIntValue(); && (xResolutionField.getValue() != null)) .getDoubleValue(); physicalWidthDpi = (int) (XResolutionPixelsPerUnit / unitsPerInch); physicalWidthInch = (float) (width / (XResolutionPixelsPerUnit * unitsPerInch)); && (yResolutionField.getValue() != null)) .getDoubleValue(); physicalHeightDpi = (int) (YResolutionPixelsPerUnit / unitsPerInch); physicalHeightInch = (float) (height / (YResolutionPixelsPerUnit * unitsPerInch)); && (bitsPerSampleField.getValue() != null)) bitsPerSample = bitsPerSampleField.getIntValueOrArraySum(); String comment = field.toString(); comments.add(comment); .getIntValue(); String compressionAlgorithm;
TiffField field = new TiffField(tag, dirType, type, length, valueOffset, valueOffsetBytes, getByteOrder()); field.setSortHint(i); field.fillInValue(byteSource); continue; int subDirectoryOffset = ((Number) entry.getValue()) .intValue(); int subDirectoryType;
public double getDoubleValue() throws ImageReadException { Object o = getValue(); if (o == null) throw new ImageReadException("Missing value: " + tagInfo.getDescription()); return ((Number) o).doubleValue(); }
public Item(TiffField entry) { // super(entry.getTagName() + " (" + entry.getFieldTypeName() + ")", super(entry.getTagName(), entry.getValueDescription()); this.entry = entry; }
String latitudeRef = latitudeRefField.getStringValue(); RationalNumber latitude[] = (RationalNumber[]) latitudeField.getValue(); String longitudeRef = longitudeRefField.getStringValue(); RationalNumber longitude[] = (RationalNumber[]) longitudeField .getValue();
Object value = srcField.getValue(); dstField.setSortHint(srcField.getSortHint()); dstDir.add(dstField);