Class ImageDeltaCompressor


  • public class ImageDeltaCompressor
    extends Object
    Provides image compression based on delta between consecutive images.
    • Constructor Detail

      • ImageDeltaCompressor

        public ImageDeltaCompressor()
    • Method Detail

      • compressByRawBlocks

        public static byte[] compressByRawBlocks​(BufferedImage target,
                                                 byte[] targetEncoded,
                                                 BufferedImage source,
                                                 int blockSize)
                                          throws IOException
        Compresses a target image based on a difference from a source image.
        Parameters:
        target - The image we want to compress. (type is TYPE_4BYTE_ABGR)
        targetEncoded - The image we want to compress in its png bytes representation.
        source - The baseline image by which a compression will be performed. (type is TYPE_4BYTE_ABGR)
        blockSize - How many pixels per block.
        Returns:
        The compression result, or the targetEncoded if the compressed bytes count is greater than the uncompressed bytes count.
        Throws:
        IOException - If there was a problem reading/writing from/to the streams which are created during the process.
      • compressByRawBlocks

        public static byte[] compressByRawBlocks​(BufferedImage target,
                                                 byte[] targetEncoded,
                                                 BufferedImage source)
                                          throws IOException
        Compresses a target image based on a difference from a source image. blockSize defaults to 10.
        Parameters:
        target - The image we want to compress.
        targetEncoded - The image we want to compress in its png bytes representation.
        source - The baseline image by which a compression will be performed.
        Returns:
        The compression result.
        Throws:
        IOException - If there was a problem reading/writing from/to the streams which are created during the process.