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 newInferFromHeader
instance. -
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.void
setFallback
(ImageMetadataReader fallback) Fallback to use if EXIF information is non-existing or absent.void
setFormats
(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 newInferFromHeader
instance.- 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:ImageMetadataReader
Opens a file containing one or more images but does not read an image.- Specified by:
openFile
in classImageMetadataReader
- Parameters:
path
- where the file is located.defaultStackReader
- the defaultStackReader
to 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
.
-