Class ImageLoaderImageIO
java.lang.Object
org.apache.xmlgraphics.image.loader.impl.AbstractImageLoader
org.apache.xmlgraphics.image.loader.impl.imageio.ImageLoaderImageIO
- All Implemented Interfaces:
ImageLoader
An ImageLoader implementation based on ImageIO for loading bitmap images.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
private static final String
protected static final org.apache.commons.logging.Log
loggerprivate static final String
private static final Set
private ImageFlavor
Fields inherited from interface org.apache.xmlgraphics.image.loader.spi.ImageLoader
MEDIUM_LOADING_PENALTY, NO_LOADING_PENALTY
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate boolean
checkProviderIgnoresICC
(IIOServiceProvider provider) Checks if the provider ignores the ICC color profile.private BufferedImage
getFallbackBufferedImage
(ImageReader reader, int pageIndex, ImageReadParam param) private ImageReadParam
getParam
(ImageReader reader, Map<String, Object> hints) Returns the image flavor that is returned by this ImageLoader implementation.Loads and returns an image.private BufferedImage
rgbToCmyk
(BufferedImage image, ImageInfo info, ImageSessionContext session) Convert RGB to CMYK using ICC file passed via fop.xconfprivate ICC_Profile
tryToExctractICCProfile
(IIOMetadata iiometa) Extract ICC Profile from ImageIO Metadata.private ICC_Profile
private ICC_Profile
Methods inherited from class org.apache.xmlgraphics.image.loader.impl.AbstractImageLoader
getUsagePenalty, ignoreColorProfile, loadImage
-
Field Details
-
log
protected static final org.apache.commons.logging.Log loglogger -
targetFlavor
-
PNG_METADATA_NODE
- See Also:
-
JPEG_METADATA_NODE
- See Also:
-
ICC_CONVERTER
- See Also:
-
PROVIDERS_IGNORING_ICC
-
-
Constructor Details
-
ImageLoaderImageIO
Main constructor.- Parameters:
targetFlavor
- the target flavor
-
-
Method Details
-
getTargetFlavor
Returns the image flavor that is returned by this ImageLoader implementation.- Returns:
- the target image flavor
-
loadImage
public Image loadImage(ImageInfo info, Map<String, Object> hints, ImageSessionContext session) throws ImageException, IOExceptionLoads and returns an image.- Parameters:
info
- the image info object indicating the imagehints
- a Map of hints that can be used by implementations to customize the loading process (may be null).session
- the session context- Returns:
- the fully loaded image
- Throws:
ImageException
- if an error occurs while loading the imageIOException
- if an I/O error occurs while loading the image
-
rgbToCmyk
private BufferedImage rgbToCmyk(BufferedImage image, ImageInfo info, ImageSessionContext session) throws IOException Convert RGB to CMYK using ICC file passed via fop.xconf- Throws:
IOException
-
getParam
- Throws:
IOException
-
checkProviderIgnoresICC
Checks if the provider ignores the ICC color profile. This method will assume providers work correctly, and return false if the provider is unknown. This ensures backward-compatibility.- Parameters:
provider
- the ImageIO Provider- Returns:
- true if we know the provider to be broken and ignore ICC profiles.
-
tryToExctractICCProfile
Extract ICC Profile from ImageIO Metadata. This method currently only supports PNG and JPEG metadata.- Parameters:
iiometa
- The ImageIO Metadata- Returns:
- an ICC Profile or null.
-
tryToExctractICCProfileFromPNGMetadataNode
-
tryToExctractICCProfileFromJPEGMetadataNode
-
getFallbackBufferedImage
private BufferedImage getFallbackBufferedImage(ImageReader reader, int pageIndex, ImageReadParam param) throws IOException - Throws:
IOException
-