@Nullable public String getExposureTimeDescription() { String value = _directory.getString(TAG_EXPOSURE_TIME); return value == null ? null : value + " sec"; }
String charSetName = directory.getString(IptcDirectory.TAG_CODED_CHARACTER_SET); Charset charset = null; try {
public void handle(Directory directory, Metadata metadata) throws MetadataException { if (directory.containsTag(IptcDirectory.TAG_KEYWORDS)) { String[] keywords = directory.getStringArray(IptcDirectory.TAG_KEYWORDS); for (String k : keywords) { metadata.add(TikaCoreProperties.SUBJECT, k); } } if (directory.containsTag(IptcDirectory.TAG_HEADLINE)) { metadata.set(TikaCoreProperties.TITLE, directory.getString(IptcDirectory.TAG_HEADLINE)); } else if (directory.containsTag(IptcDirectory.TAG_OBJECT_NAME)) { metadata.set(TikaCoreProperties.TITLE, directory.getString(IptcDirectory.TAG_OBJECT_NAME)); } if (directory.containsTag(IptcDirectory.TAG_BY_LINE)) { metadata.set(TikaCoreProperties.CREATOR, directory.getString(IptcDirectory.TAG_BY_LINE)); metadata.set(IPTC.CREATOR, directory.getString(IptcDirectory.TAG_BY_LINE)); } if (directory.containsTag(IptcDirectory.TAG_CAPTION)) { metadata.set(TikaCoreProperties.DESCRIPTION, // Looks like metadata extractor returns IPTC newlines as a single carriage return, // but the exiv2 command does not so we change to line feed here because that is less surprising to users directory.getString(IptcDirectory.TAG_CAPTION).replaceAll("\r\n?", "\n")); } } }
@Nullable public String getRowsPerStripDescription() { final String value = _directory.getString(TAG_ROWS_PER_STRIP); return value == null ? null : value + " rows/strip"; }
@Nullable public String getImageHeightDescription() { String value = _directory.getString(TAG_IMAGE_HEIGHT); return value == null ? null : value + " pixels"; }
@Nullable public String getBitsPerSampleDescription() { String value = _directory.getString(TAG_BITS_PER_SAMPLE); return value == null ? null : value + " bits/component/pixel"; }
@Nullable public String getSamplesPerPixelDescription() { String value = _directory.getString(TAG_SAMPLES_PER_PIXEL); return value == null ? null : value + " samples/pixel"; }
@Nullable public String getInteropIndexDescription() { String value = _directory.getString(TAG_INTEROP_INDEX); if (value == null) return null; return "R98".equalsIgnoreCase(value.trim()) ? "Recommended Exif Interoperability Rules (ExifR98)" : "Unknown (" + value + ")"; }
@Nullable public String getImageWidthDescription() { String value = _directory.getString(TAG_IMAGE_WIDTH); return value == null ? null : value + " pixels"; }
@Nullable public String getStripByteCountsDescription() { final String value = _directory.getString(TAG_STRIP_BYTE_COUNTS); return value == null ? null : value + " bytes"; }
@Nullable protected String getFormattedString(final int tagType, @NotNull final String format) { String value = _directory.getString(tagType); if (value == null) return null; return String.format(format, value); }
return _directory.getString(tagType);
/** * A basic representation of the tag's type and value. EG: <code>[Exif IFD0] FNumber - f/2.8</code>. * * @return the tag's type and value */ @Override @NotNull public String toString() { String description = getDescription(); if (description == null) description = _directory.getString(getTagType()) + " (unable to formulate description)"; return "[" + _directory.getName() + "] " + getTagName() + " - " + description; } }
String cameraMake = ifd0Directory == null ? null : ifd0Directory.getString(ExifIFD0Directory.TAG_MAKE);
private void set(Directory directory, Metadata metadata, int extractTag, Property metadataField) { if (directory.containsTag(extractTag)) { Matcher m = LEADING_NUMBERS.matcher(directory.getString(extractTag)); if (m.matches()) { metadata.set(metadataField, m.group(1)); } } } }
public void handle(Directory directory, Metadata metadata) throws MetadataException { if (directory.containsTag(JpegCommentDirectory.TAG_COMMENT)) { metadata.add(TikaCoreProperties.COMMENTS, directory.getString(JpegCommentDirectory.TAG_COMMENT)); } } }
/** * EXIF may contain image description, although with undefined encoding. * Use IPTC for other annotation fields, and XMP for unicode support. */ public void handleCommentTags(Directory directory, Metadata metadata) { if (metadata.get(TikaCoreProperties.DESCRIPTION) == null && directory.containsTag(ExifIFD0Directory.TAG_IMAGE_DESCRIPTION)) { metadata.set(TikaCoreProperties.DESCRIPTION, directory.getString(ExifIFD0Directory.TAG_IMAGE_DESCRIPTION)); } }
metadata.set(Metadata.EXPOSURE_TIME, ((Rational) exposure).doubleValue()); } else { metadata.set(Metadata.EXPOSURE_TIME, directory.getString(ExifSubIFDDirectory.TAG_EXPOSURE_TIME)); metadata.set(Metadata.F_NUMBER, ((Rational) fnumber).doubleValue()); } else { metadata.set(Metadata.F_NUMBER, directory.getString(ExifSubIFDDirectory.TAG_FNUMBER)); metadata.set(Metadata.FOCAL_LENGTH, ((Rational) length).doubleValue()); } else { metadata.set(Metadata.FOCAL_LENGTH, directory.getString(ExifSubIFDDirectory.TAG_FOCAL_LENGTH)); metadata.set(Metadata.ISO_SPEED_RATINGS, directory.getString(ExifSubIFDDirectory.TAG_ISO_EQUIVALENT)); metadata.set(Metadata.EQUIPMENT_MAKE, directory.getString(ExifIFD0Directory.TAG_MAKE)); metadata.set(Metadata.EQUIPMENT_MODEL, directory.getString(ExifIFD0Directory.TAG_MODEL)); metadata.set(Metadata.ORIENTATION, Integer.toString((Integer) length)); } else { metadata.set(Metadata.ORIENTATION, directory.getString(ExifIFD0Directory.TAG_ORIENTATION)); metadata.set(Metadata.SOFTWARE, directory.getString(ExifIFD0Directory.TAG_SOFTWARE)); metadata.set(Metadata.RESOLUTION_HORIZONTAL, ((Rational) resolution).doubleValue()); } else { metadata.set(Metadata.RESOLUTION_HORIZONTAL, directory.getString(ExifIFD0Directory.TAG_X_RESOLUTION)); metadata.set(Metadata.RESOLUTION_VERTICAL, ((Rational) resolution).doubleValue());
@Nullable public String getImageHeightDescription() { String value = _directory.getString(TAG_IMAGE_HEIGHT); return value == null ? null : value + " pixels"; }
/** * EXIF may contain image description, although with undefined encoding. * Use IPTC for other annotation fields, and XMP for unicode support. */ public void handleCommentTags(Directory directory, Metadata metadata) { if (metadata.get(TikaCoreProperties.DESCRIPTION) == null && directory.containsTag(ExifIFD0Directory.TAG_IMAGE_DESCRIPTION)) { metadata.set(TikaCoreProperties.DESCRIPTION, directory.getString(ExifIFD0Directory.TAG_IMAGE_DESCRIPTION)); } }