Class InferFromHeader
Tries to construct the
ImageMetadata from EXIF and other metadata, if available, or
otherwise falls back to another reader.
It supports a limited number of file-types, as identified by an extension in the path. By default, it supports:
- JPEG (.jpg or .jpeg)
- PNG (.png)
- Author:
- Owen Feehan
-
Constructor Summary
ConstructorsConstructorDescriptionInferFromHeader(ImageMetadataReader fallback, List<HeaderFormat> formats) Creates a newInferFromHeaderinstance. -
Method Summary
Modifier and TypeMethodDescriptionFallback to use if EXIF information is non-existing or absent.The formats whose headers will be searched, to find sufficient metadata to populateImageMetadata.openFile(Path path, StackReader defaultStackReader, OperationContext context) Opens a file containing one or more images but does not read an image.voidsetFallback(ImageMetadataReader fallback) Fallback to use if EXIF information is non-existing or absent.voidsetFormats(List<HeaderFormat> formats) The formats whose headers will be searched, to find sufficient metadata to populateImageMetadata.Methods inherited from class org.anchoranalysis.bean.AnchorBean
checkMisconfigured, describeBean, describeChildren, duplicateBean, fields, findFieldsOfClass, getBeanName, getLocalPath, localise, toString
-
Constructor Details
-
InferFromHeader
public InferFromHeader() -
InferFromHeader
Creates a newInferFromHeaderinstance.- Parameters:
fallback- Fallback to use if EXIF information is non-existing or absent.formats- The formats whose headers will be searched, to find sufficient metadata to populateImageMetadata.
-
-
Method Details
-
openFile
public ImageMetadata openFile(Path path, StackReader defaultStackReader, OperationContext context) throws ImageIOException Description copied from class:ImageMetadataReaderOpens a file containing one or more images but does not read an image.- Specified by:
openFilein classImageMetadataReader- Parameters:
path- where the file is located.defaultStackReader- the defaultStackReaderto use, if needed, and if not otherwise specified, for reading metadata.context- context for reading a stack from the file-system.- Returns:
- an interface to the opened file that should be closed when no longer in use.
- Throws:
ImageIOException- if the file cannot be read.
-
getFallback
Fallback to use if EXIF information is non-existing or absent. -
setFallback
Fallback to use if EXIF information is non-existing or absent. -
getFormats
The formats whose headers will be searched, to find sufficient metadata to populateImageMetadata. -
setFormats
The formats whose headers will be searched, to find sufficient metadata to populateImageMetadata.
-