JBoss.orgCommunity Documentation
The ImageMetadataSequencer
sequencer extracts metadata from JPEG, GIF, BMP, PCX, PNG, IFF, RAS, PBM, PGM, PPM and PSD image files.
This sequencer extracts the file format, image resolution, number of bits per pixel and optionally number of images, comments
and physical resolution, and then writes this information into the repository using the following structure:
image:metadata node of type image:metadata
jcr:mimeType - optional string property for the mime type of the image
jcr:encoding - optional string property for the encoding of the image
image:formatName - string property for the name of the format
image:width - optional integer property for the image's width in pixels
image:height - optional integer property for the image's height in pixles
image:bitsPerPixel - optional integer property for the number of bits per pixel
image:progressive - optional boolean property specifying whether the image is stored in a progressive (i.e., interlaced) form
image:numberOfImages - optional integer property for the number of images stored in the file; defaults to 1
image:physicalWidthDpi - optional integer property for the physical width of the image in dots per inch
image:physicalHeightDpi - optional integer property for the physical height of the image in dots per inch
image:physicalWidthInches - optional double property for the physical width of the image in inches
image:physicalHeightInches - optional double property for the physical height of the image in inches
This structure could be extended in the future to add EXIF and IPTC metadata as child nodes. For example, EXIF metadata is structured as tags in directories, where the directories form something like namespaces, and which are used by different camera vendors to store custom metadata. This structure could be mapped with each directory (e.g. "EXIF" or "Nikon Makernote" or "IPTC") as the name of a child node, with the EXIF tags values stored as either properties or child nodes.
To use this sequencer, simply include the modeshape-sequencer-images
JAR
in your application and configure the JcrConfiguration
to use this sequencer using something similar to:
JcrConfiguration config = ...
config.sequencer("Image Sequencer")
.usingClass("org.modeshape.sequencer.image.ImageMetadataSequencer")
.loadedFromClasspath()
.setDescription("Sequences image files to extract the characteristics of the image")
.sequencingFrom("//(*.(jpg|jpeg|gif|bmp|pcx|png|iff|ras|pbm|pgm|ppm|psd)[*])/jcr:content[@jcr:data]")
.andOutputtingTo("/images/$1");