Class ImageTransformer
- All Implemented Interfaces:
Configurable<ImageTransformerConfig>,ConfigurableDocHandler<ImageTransformerConfig>,DocHandler
Transforms an image using common image operations.
This class should only be used as a pre-parsing handler, on image files.
It may also be appropriate to disable parsing of those images if you
want to keep the transformed version intact. This can be done by
configuring DefaultParser
as a handler in the ImporterConfig.
Content-types
By default, this filter is restricted to (applies only to) documents matching
the restrictions returned by
CommonRestrictions.imageIOStandardContentTypes(String).
You can specify your own content types if you know they represent a supported
image.
Image dimension format
For a list of supported image dimension formats, refer to
DimensionConverter.
Usage example:
The above example converts images to PNG while scaling it to a maximum dimension of 400 pixels wide and 250 pixel high.
- See Also:
-
Field Summary
Fields inherited from interface com.norconex.commons.lang.config.Configurable
PROPERTYFields inherited from interface com.norconex.importer.handler.DocHandler
NAME -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanbooleanbooleanhandle(DocHandlerContext docCtx) Perform any operations on a document.inthashCode()toString()voidtransformImage(MutableImage image) Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.norconex.importer.handler.DocHandler
close, init
-
Constructor Details
-
ImageTransformer
public ImageTransformer()
-
-
Method Details
-
handle
Description copied from interface:DocHandlerPerform any operations on a document.- Specified by:
handlein interfaceDocHandler- Parameters:
docCtx- the document handling context- Returns:
falseto stop processing and reject a document ortrueto proceed to the next configured handler.- Throws:
IOException- An I/O exception of some sort has occurred
-
transformImage
-
getConfiguration
- Specified by:
getConfigurationin interfaceConfigurable<ImageTransformerConfig>
-
equals
-
canEqual
-
hashCode
public int hashCode() -
toString
-