Package com.idrsolutions.image.png
Class PngCompressor
java.lang.Object
com.idrsolutions.image.JDeliImage
com.idrsolutions.image.png.PngCompressor
public class PngCompressor
extends com.idrsolutions.image.JDeliImage
This class is provided in order to offer command-line access for compressing
PNG files.
It also exposes static helper methods for Java developers to use.
Command Line Instructions:
java [options] -jar jdeli.jar compresspng [pngfile [pngfile ...]]
Options:
- -Doverwrite=true (overwrite input files - by default is "false")
- -Dverbose=true (print status messages - by default is "false")
Example 1:
java -jar jdeli.jar compresspng file.png
Example 2 (multiple files):
java -jar jdeli.jar compresspng file1.png file2.png
Example 3 (with overwrite option):
java -Doverwrite=true -jar jdeli.jar compresspng /directory/*.png
Example 4 (with verbose option):
java -Dverbose=true -jar jdeli.jar compresspng /directory/*.png
The output filename is the same as the input name except that _compressed will be appended to the name. E.g. file.png will become file_compressed.png This can be changed to overwrite the existing file by setting the overwrite setting to true.
-
Field Summary
Fields inherited from class com.idrsolutions.image.JDeliImage
bb
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
compress
(InputStream inputStream, OutputStream outputStream) Compress a 24/32 bit image into 8 bit palette image;static void
For instructions, see main Javadoc for classMethods inherited from class com.idrsolutions.image.JDeliImage
optimiseImage
-
Constructor Details
-
PngCompressor
public PngCompressor()
-
-
Method Details
-
compress
Compress a 24/32 bit image into 8 bit palette image;This method does not close the provided OutputStream after the write operation has completed; it is the responsibility of the caller to close the stream,
- Parameters:
inputStream
- PNG file as InputStreamoutputStream
- Compressed PNG file as OutputStream- Throws:
IOException
- Input or output exception has occurred
-
main
For instructions, see main Javadoc for class- Parameters:
args
- For instructions, see main Javadoc for class
-