Package com.idrsolutions.image.png
Class PngDecoder
java.lang.Object
com.idrsolutions.image.JDeliImage
com.idrsolutions.image.png.PngDecoder
- All Implemented Interfaces:
com.idrsolutions.image.Decoder
public class PngDecoder
extends com.idrsolutions.image.JDeliImage
implements com.idrsolutions.image.Decoder
Class reads PNG images as BufferedImage.
Make NO assumptions about the type of
BufferedImage type returned (it may change)
Example 1 (Using raw byte data):
PngDecoder decoder = new PngDecoder();
BufferedImage decodedImage = decoder.read(pngByteData);
Example 2 (Using File):
File pngFile = new File("C:\\path\\to\\output\\file.png");
PngDecoder decoder = new PngDecoder();
BufferedImage decodedImage = decoder.read(pngFile);
-
Field Summary
Fields inherited from class com.idrsolutions.image.JDeliImage
bb
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionread
(byte[] pngRawData) Decodes and returns the PNG image as a BufferedImage from bytesDecodes and returns the PNG image as a BufferedImage from a FilereadDimension
(byte[] pngRawData) Decodes and returns the width and height of png imagereadDimension
(File file) Decodes and returns the width and height of png imageMethods inherited from class com.idrsolutions.image.JDeliImage
optimiseImage
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.idrsolutions.image.Decoder
getImageCount, getImageCount, readEmbeddedThumbnail, readEmbeddedThumbnail, readImageAt, readImageAt, readImageSpecificMetaData, readImageSpecificMetaData, setMetadata
-
Constructor Details
-
PngDecoder
public PngDecoder()
-
-
Method Details
-
read
Decodes and returns the PNG image as a BufferedImage from bytes- Specified by:
read
in interfacecom.idrsolutions.image.Decoder
- Parameters:
pngRawData
- byte[] containing the PNG data to be decoded- Returns:
- BufferedImage The decoded image
- Throws:
Exception
- if an error occurs in reading image
-
read
Decodes and returns the PNG image as a BufferedImage from a File- Specified by:
read
in interfacecom.idrsolutions.image.Decoder
- Parameters:
file
- input image file to be decoded- Returns:
- BufferedImage decoded image
- Throws:
Exception
- if an error occurs in reading image
-
readDimension
Decodes and returns the width and height of png image- Specified by:
readDimension
in interfacecom.idrsolutions.image.Decoder
- Parameters:
file
- image contained in raw data if present- Returns:
- width and height of image
- Throws:
Exception
- if problem reading image
-
readDimension
Decodes and returns the width and height of png image- Specified by:
readDimension
in interfacecom.idrsolutions.image.Decoder
- Parameters:
pngRawData
- image contained in raw data if present- Returns:
- Rectangle width and height of image
- Throws:
Exception
- if problem reading image
-