Class JPEGImageReader
java.lang.Object
javax.imageio.ImageReader
com.twelvemonkeys.imageio.ImageReaderBase
com.twelvemonkeys.imageio.plugins.jpeg.JPEGImageReader
A JPEG
Main features:
ImageReader implementation based on the JRE JPEGImageReader,
that adds support and properly handles cases where the JRE version throws exceptions.
Main features:
- Support for YCbCr JPEGs without JFIF segment (converted to RGB, using the embedded ICC profile if applicable)
- Support for CMYK JPEGs (converted to RGB by default or as CMYK, using the embedded ICC profile if applicable)
- Support for Adobe YCCK JPEGs (converted to RGB by default or as CMYK, using the embedded ICC profile if applicable)
- Support for JPEGs containing ICC profiles with interpretation other than 'Perceptual' (profile is assumed to be 'Perceptual' and used)
- Support for JPEGs containing ICC profiles with class other than 'Display' (profile is assumed to have class 'Display' and used)
- Support for JPEGs containing ICC profiles that are incompatible with stream data (image data is read, profile is ignored)
- Support for JPEGs with corrupted ICC profiles (image data is read, profile is ignored)
- Support for JPEGs with corrupted
ICC_PROFILEsegments (image data is read, profile is ignored) - Support for JPEGs using non-standard color spaces, unsupported by Java 2D (image data is read, profile is ignored)
- Issues warnings instead of throwing exceptions in cases of corrupted data where ever the image data can still be read in a reasonable way
- Support for JFIF thumbnails (even if stream contains inconsistent metadata)
- Support for JFXX thumbnails (JPEG, Indexed and RGB)
- Support for EXIF thumbnails (JPEG, RGB and YCbCr)
- Support for JPEG metadata in both standard and native formats (even if stream contains inconsistent metadata)
- Support for
javax_imageio_jpeg_image_1.0format (currently as native format, may change in the future) - Support for illegal combinations of JFIF, Exif and Adobe markers, using "unknown" segments in the
"MarkerSequence" tag for the unsupported segments (for
javax_imageio_jpeg_image_1.0format)
- Version:
- $Id: JPEGImageReader.java,v 1.0 24.01.11 16.37 haraldk Exp$
- Author:
- Harald Kuhr, LUT-based YCbCR conversion by Werner Randelshofer, last modified by $Author: haraldk$
-
Field Summary
Fields inherited from class ImageReaderBase
imageInputFields inherited from class ImageReader
availableLocales, ignoreMetadata, input, locale, minIndex, originatingProvider, progressListeners, seekForwardOnly, updateListeners, warningListeners, warningLocales -
Method Summary
Modifier and TypeMethodDescriptionvoidabort()booleanvoiddispose()intgetHeight(int imageIndex) getImageMetadata(int imageIndex) Default implementation that always returnsnull.getImageTypes(int imageIndex) intgetNumImages(boolean allowSearch) Default implementation that always returns1.intgetNumThumbnails(int imageIndex) getRawImageType(int imageIndex) Default implementation that always returnsnull.intgetThumbnailHeight(int imageIndex, int thumbnailIndex) intgetThumbnailWidth(int imageIndex, int thumbnailIndex) intgetWidth(int imageIndex) static voidprotected voidprocessWarningOccurred(String warning) read(int imageIndex, ImageReadParam param) readAsRenderedImage(int imageIndex, ImageReadParam param) booleanreadRaster(int imageIndex, ImageReadParam param) readThumbnail(int imageIndex, int thumbnailIndex) protected voidResets all member variables.voidOverridessetInput, to allow easy access to the input, in case it is anImageInputStream.protected static voidshowIt(BufferedImage pImage, String pTitle) Methods inherited from class ImageReaderBase
assertInput, checkBounds, fakeAOI, fakeSubsampling, getDestination, hasExplicitDestination, resetMethods inherited from class ImageReader
abortRequested, addIIOReadProgressListener, addIIOReadUpdateListener, addIIOReadWarningListener, checkReadParamBandSettings, clearAbortRequest, computeRegions, getAspectRatio, getAvailableLocales, getImageMetadata, getInput, getLocale, getMinIndex, getOriginatingProvider, getSourceRegion, getStreamMetadata, getTileGridXOffset, getTileGridYOffset, getTileHeight, getTileWidth, hasThumbnails, isIgnoringMetadata, isImageTiled, isRandomAccessEasy, isSeekForwardOnly, processImageComplete, processImageProgress, processImageStarted, processImageUpdate, processPassComplete, processPassStarted, processReadAborted, processSequenceComplete, processSequenceStarted, processThumbnailComplete, processThumbnailPassComplete, processThumbnailPassStarted, processThumbnailProgress, processThumbnailStarted, processThumbnailUpdate, processWarningOccurred, read, readAll, readAll, readTile, readTileRaster, removeAllIIOReadProgressListeners, removeAllIIOReadUpdateListeners, removeAllIIOReadWarningListeners, removeIIOReadProgressListener, removeIIOReadUpdateListener, removeIIOReadWarningListener, setInput, setInput, setLocale
-
Method Details
-
resetMembers
protected void resetMembers()Description copied from class:ImageReaderBaseResets all member variables. This method is by default invoked from:- Specified by:
resetMembersin classImageReaderBase
-
dispose
public void dispose()- Overrides:
disposein classImageReaderBase
-
getFormatName
- Overrides:
getFormatNamein classImageReader- Throws:
IOException
-
getWidth
- Specified by:
getWidthin classImageReader- Throws:
IOException
-
getHeight
- Specified by:
getHeightin classImageReader- Throws:
IOException
-
getImageTypes
- Specified by:
getImageTypesin classImageReader- Throws:
IOException
-
getRawImageType
- Overrides:
getRawImageTypein classImageReader- Throws:
IOException
-
read
- Specified by:
readin classImageReader- Throws:
IOException
-
setInput
Description copied from class:ImageReaderBaseOverridessetInput, to allow easy access to the input, in case it is anImageInputStream.- Overrides:
setInputin classImageReaderBase- Parameters:
input- theImageInputStreamor otherObjectto use for future decoding.seekForwardOnly- iftrue, images and metadata may only be read in ascending order from this input source.ignoreMetadata- iftrue, metadata may be ignored during reads.- See Also:
-
getNumImages
Description copied from class:ImageReaderBaseDefault implementation that always returns1.- Overrides:
getNumImagesin classImageReaderBase- Parameters:
allowSearch- ignored, unless overridden- Returns:
1, unless overridden- Throws:
IOException- never, unless overridden
-
canReadRaster
public boolean canReadRaster()- Overrides:
canReadRasterin classImageReader
-
readRaster
- Overrides:
readRasterin classImageReader- Throws:
IOException
-
readAsRenderedImage
- Overrides:
readAsRenderedImagein classImageReader- Throws:
IOException
-
abort
public void abort()- Overrides:
abortin classImageReader
-
getDefaultReadParam
- Overrides:
getDefaultReadParamin classImageReader
-
readerSupportsThumbnails
public boolean readerSupportsThumbnails()- Overrides:
readerSupportsThumbnailsin classImageReader
-
getNumThumbnails
- Overrides:
getNumThumbnailsin classImageReader- Throws:
IOException
-
getThumbnailWidth
- Overrides:
getThumbnailWidthin classImageReader- Throws:
IOException
-
getThumbnailHeight
- Overrides:
getThumbnailHeightin classImageReader- Throws:
IOException
-
readThumbnail
- Overrides:
readThumbnailin classImageReader- Throws:
IOException
-
getImageMetadata
Description copied from class:ImageReaderBaseDefault implementation that always returnsnull.- Overrides:
getImageMetadatain classImageReaderBase- Parameters:
imageIndex- ignored, unless overridden- Returns:
null, unless overridden- Throws:
IOException- never, unless overridden.
-
getStreamMetadata
Description copied from class:ImageReaderBaseDefault implementation that always returnsnull.- Overrides:
getStreamMetadatain classImageReaderBase- Returns:
null, unless overridden- Throws:
IOException- never, unless overridden.
-
processWarningOccurred
- Overrides:
processWarningOccurredin classImageReader
-
showIt
-
main
- Throws:
IOException
-