Class 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 ...]]


    1. -Doverwrite=true (overwrite input files - by default is "false")
    2. -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.

    • Constructor Summary

      Constructor Description
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void compress​( inputStream, outputStream)
      Compress a 24/32 bit image into 8 bit palette image;
      static void main​(java.lang.String[] args)
      For instructions, see main Javadoc for class
      • Methods inherited from class com.idrsolutions.image.JDeliImage

      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PngCompressor

        public PngCompressor()
    • Method Detail

      • compress

        public static void compress​( inputStream,
        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,

        inputStream - PNG file as InputStream
        outputStream - Compressed PNG file as OutputStream
        Throws: - Input or output exception has occurred
      • main

        public static void main​(java.lang.String[] args)
        For instructions, see main Javadoc for class
        args - For instructions, see main Javadoc for class