A collection of image processing utilities
A utility that generates JSON objects that contain image metadata.
./gradlew clean distTar
- extract
image.metadata-0.2.0-SNAPSHOT.tar
This tool assumes that all images will have integer filenames in accordance with their sequence in the image collection.
This tool recognizes files with the extensions ".jpx" or ".jp2" and will read their dimensions.
This requires the host to have the ImageMagick identify
utility compiled with JP2 support available in the PATH.
To install this utility, check the releases
image.metadata -i image_source_directory -o dimension_manifest [-z] metadata_manifest
Argument | Description | Example |
---|---|---|
image_source_directory_path | the file path to the image sources | /images |
dimension_manifest | a file path to the manifest outputfile | /output.json |
metadata_manifest (optional) | a file path to the metadata manifest outputfile | /manifest.json |
compile group: 'de.ubleipzig', name: 'image.metadata', version: '0.1.0'
- Generate an image dimension manifest with :
/**
* @param String imageSourceDir
*/
ImageMetadataServiceConfig config = new ImageMetadataServiceConfig();
config.setImageSourceDir(imageSourceDir);
final ImageMetadataService generator = new ImageMetadataServiceImpl(config);
final ImageDimensionManifest dimManifest = generator.build();
The dimension manifest when serialized looks like this:
{
"collection" : "/some-image-collection",
"images" : [
{
"filename" : "00000001.jpg",
"digest" : "jeUrOCoqaYw/89LmIo3gQlxhipE=",
"height" : 2130,
"width" : 1705
},
{
"filename" : "00000002.jpg",
"digest" : "5t/uKe+X1vTe0fR2YAGYj4OzgiI=",
"height" : 2130,
"width" : 1705
},
{
"filename" : "00000003.jpg",
"digest" : "8caG/XPRwwAZSU3Pldcsl7ZEtoA=",
"height" : 2130,
"width" : 1705
}
]
}
The ImageDimensionManifest
is a List<ImageDimensions>
where each ImageDimension
has setter and getters available
for subsequent processing.
Also available is the complete list of ImageMetadataTag
. This ImageMetadataManifest
can be built like this:
ImageMetadataServiceConfig config = new ImageMetadataServiceConfig();
config.setImageSourceDir(imageSourceDir);
final ImageMetadataService generator = new ImageMetadataServiceImpl(config);
final ImageDimensionManifest dimManifest = generator.buildImageMetadataManifest();
An typical JPEG image produces this:
{
"filename" : "00000001.jpg",
"digest" : "jeUrOCoqaYw/89LmIo3gQlxhipE=",
"directories" : [
{
"directory" : "JPEG",
"tags" : [
{
"tagName" : "Compression Type",
"tagDescription" : "Baseline"
},
{
"tagName" : "Data Precision",
"tagDescription" : "8 bits"
},
{
"tagName" : "Image Height",
"tagDescription" : "2130 pixels"
},
{
"tagName" : "Image Width",
"tagDescription" : "1705 pixels"
},
{
"tagName" : "Number of Components",
"tagDescription" : "3"
},
{
"tagName" : "Component 1",
"tagDescription" : "Y component: Quantization table 0, Sampling factors 2 horiz/2 vert"
},
{
"tagName" : "Component 2",
"tagDescription" : "Cb component: Quantization table 1, Sampling factors 1 horiz/1 vert"
},
{
"tagName" : "Component 3",
"tagDescription" : "Cr component: Quantization table 1, Sampling factors 1 horiz/1 vert"
}
]
},
{
"directory" : "JpegComment",
"tags" : [
{
"tagName" : "JPEG Comment",
"tagDescription" : "Generated by IIPImage"
}
]
},
{
"directory" : "JFIF",
"tags" : [
{
"tagName" : "Version",
"tagDescription" : "1.1"
},
{
"tagName" : "Resolution Units",
"tagDescription" : "none"
},
{
"tagName" : "X Resolution",
"tagDescription" : "1 dot"
},
{
"tagName" : "Y Resolution",
"tagDescription" : "1 dot"
},
{
"tagName" : "Thumbnail Width Pixels",
"tagDescription" : "0"
},
{
"tagName" : "Thumbnail Height Pixels",
"tagDescription" : "0"
}
]
},
{
"directory" : "Huffman",
"tags" : [
{
"tagName" : "Number of Tables",
"tagDescription" : "4 Huffman tables"
}
]
},
{
"directory" : "File Type",
"tags" : [
{
"tagName" : "Detected File Type Name",
"tagDescription" : "JPEG"
},
{
"tagName" : "Detected File Type Long Name",
"tagDescription" : "Joint Photographic Experts Group"
},
{
"tagName" : "Detected MIME Type",
"tagDescription" : "image/jpeg"
},
{
"tagName" : "Expected File Name Extension",
"tagDescription" : "jpg"
}
]
}
]
}
This library depends on the com.drewnoakes:metadata-extractor