/** * Get a description of the tag's value, considering enumerated values * and units. * * @return a description of the tag's value */ @Nullable public String getDescription() { return _directory.getDescription(_tagType); }
String flash = directory.getDescription(ExifSubIFDDirectory.TAG_FLASH); if (flash != null) { if (flash.contains("Flash fired")) { metadata.set(Metadata.RESOLUTION_UNIT, directory.getDescription(ExifIFD0Directory.TAG_RESOLUTION_UNIT)); trimPixels(directory.getDescription(ExifThumbnailDirectory.TAG_IMAGE_WIDTH))); trimPixels(directory.getDescription(ExifThumbnailDirectory.TAG_IMAGE_HEIGHT)));
/** * Get a description of the tag's value, considering enumerated values * and units. * * @return a description of the tag's value */ @Nullable public String getDescription() { return _directory.getDescription(_tagType); }
public void setColorMode(Directory directory, int tagType) { String colorMode = directory.getDescription(tagType); if (colorMode != null) { setColorMode(colorMode); } }
private void populateMetadata(Metadata metadata) { for (Iterator<?> di = metadata.getDirectories().iterator(); di.hasNext();) { Directory directory = (Directory) di.next(); Map<String, String> tags = new HashMap<String, String>(); put(directory.getName(), tags); for (Iterator<?> ti = directory.getTags().iterator(); ti.hasNext();) { Tag tag = (Tag) ti.next(); try { tags.put(tag.getTagName(), directory.getDescription(tag.getTagType())); } catch (Exception error) { errors.add(error); } } } }
@Override public void extractMetadata(byte[] bytes, Map<String, String> md) { BufferedInputStream bis = new BufferedInputStream(new ByteArrayInputStream(bytes)); try { Metadata metadata = ImageMetadataReader.readMetadata(bis, false); for (Directory directory : metadata.getDirectories()) { for (Tag tag : directory.getTags()) { String key = tag.getTagName(); if (md.containsKey(key)) { key = String.format("%s (%s)", tag.getTagName(), tag.getDirectoryName()); } String value = directory.getDescription(tag.getTagType()); if (StringUtils.isNotEmpty(value) && value.startsWith("[") && value.endsWith("bytes]")) { byte[] tagBytes = directory.getByteArray(tag.getTagType()); value = Base64.encodeBase64String(tagBytes); } md.put(key, value); } } } catch (Exception ex) { ex.printStackTrace(); } } }
String flash = directory.getDescription(ExifSubIFDDirectory.TAG_FLASH); if (flash != null) { if (flash.contains("Flash fired")) { metadata.set(Metadata.RESOLUTION_UNIT, directory.getDescription(ExifIFD0Directory.TAG_RESOLUTION_UNIT)); trimPixels(directory.getDescription(ExifThumbnailDirectory.TAG_IMAGE_WIDTH))); trimPixels(directory.getDescription(ExifThumbnailDirectory.TAG_IMAGE_HEIGHT)));
String flash = directory.getDescription(ExifSubIFDDirectory.TAG_FLASH); if (flash != null) { if (flash.contains("Flash fired")) { metadata.set(Metadata.RESOLUTION_UNIT, directory.getDescription(ExifIFD0Directory.TAG_RESOLUTION_UNIT)); trimPixels(directory.getDescription(ExifThumbnailDirectory.TAG_IMAGE_WIDTH))); trimPixels(directory.getDescription(ExifThumbnailDirectory.TAG_IMAGE_HEIGHT)));
Object value; if (descriptive || isDescriptionTag(directory, tagType)) { value = directory.getDescription(tagType); if (directory instanceof PngDirectory) { if (((PngDirectory) directory).getPngChunkType().areMultipleAllowed()) {