Package com.idrsolutions.image.png
Class PngEncoder
java.lang.Object
com.idrsolutions.image.JDeliImage
com.idrsolutions.image.png.PngEncoder
- All Implemented Interfaces:
com.idrsolutions.image.Encoder
public class PngEncoder
extends com.idrsolutions.image.JDeliImage
implements com.idrsolutions.image.Encoder
Class writes BufferedImages as Fast deflated Png
Example 1:
PngEncoder encoder = new PngEncoder();
encoder.write(image, outputStream);
Example 2 (with 8 bit quantisation compression):
PngEncoder encoder = new PngEncoder();
encoder.getEncoderOptions().setCompressionFormat(PngCompressionFormat.QUANTISED8BIT);
encoder.write(image, outputStream);
-
Field Summary
Fields inherited from class com.idrsolutions.image.JDeliImage
bb
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Deprecated.- use getEncoderOptions().getCompressionFormat().equals(PngCompressionFormat.QUANTISED8BIT); Returns whether Deflate compression is enabled in tiff generation.boolean
Deprecated.- use getEncoderOptions().isOptimizeBasedOnColors();void
setCompressed
(boolean compress) Deprecated.- usepngEncoderOptions.setCompressionFormat(PngCompressionFormat pngCompression); setEncoderOptions(pngEncoderOptions);
void
setEncoderOptions
(PngEncoderOptions pngEncoderOptions) void
setOptimizeBasedOnColors
(boolean optimizeBasedOnColors) Deprecated.- usepngEncoderOptions.setOptimizeBasedOnColors(boolean); setEncoderOptions(pngEncoderOptions);
void
write
(BufferedImage image, File file) Writes BufferedImage as a PNG into a filevoid
write
(BufferedImage image, OutputStream outputStream) Writes BufferedImage as a PNG into an OutputStreamMethods inherited from class com.idrsolutions.image.JDeliImage
optimiseImage
-
Constructor Details
-
PngEncoder
public PngEncoder(com.idrsolutions.image.encoder.options.EncoderOptions format) -
PngEncoder
public PngEncoder()
-
-
Method Details
-
write
Writes BufferedImage as a PNG into an OutputStreamThis method does not close the provided OutputStream after the write operation has completed; it is the responsibility of the caller to close the stream.
- Specified by:
write
in interfacecom.idrsolutions.image.Encoder
- Parameters:
image
- BufferedImage to writeoutputStream
- The stream to write the image to- Throws:
IOException
- if the image wasn't written
-
write
Writes BufferedImage as a PNG into a file- Parameters:
image
- BufferedImage to writefile
- The file the image to be written as png- Throws:
IOException
- if the image wasn't written
-
isCompressed
Deprecated.- use getEncoderOptions().getCompressionFormat().equals(PngCompressionFormat.QUANTISED8BIT); Returns whether Deflate compression is enabled in tiff generation.- Returns:
- Whether compression is enabled
-
getEncoderOptions
-
setEncoderOptions
-
setCompressed
Deprecated.- usepngEncoderOptions.setCompressionFormat(PngCompressionFormat pngCompression); setEncoderOptions(pngEncoderOptions);
Set true to enable 8 bit quantisation compression in PNG generation- Parameters:
compress
- value to determine if compression used
-
isOptimizeBasedOnColors
Deprecated.- use getEncoderOptions().isOptimizeBasedOnColors();- Returns:
- Whether compression feature is enabled
-
setOptimizeBasedOnColors
Deprecated.- usepngEncoderOptions.setOptimizeBasedOnColors(boolean); setEncoderOptions(pngEncoderOptions);
- Parameters:
optimizeBasedOnColors
- value to determine strategy of image optimisation
-