Simple but efficient way to store a series of small changes to an image?
        Posted  
        
            by finnw
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by finnw
        
        
        
        Published on 2010-03-31T02:55:49Z
        Indexed on 
            2010/03/31
            3:03 UTC
        
        
        Read the original article
        Hit count: 403
        
I have a series of images. Each one is typically (but not always) similar to the previous one, with 3 or 4 small rectangular regions updated. I need to record these changes using a minimum of disk space.
The source images are not compressed, but I would like the deltas to be compressed.
I need to be able to recreate the images exactly as input (so a lossy video codec is not appropriate.)
I am thinking of something along the lines of:
- Composite the new image with a negative of the old image
 - Save the composited image in any common format that can compress using RLE (probably PNG.)
 - Recreate the second image by compositing the previous image with the delta.
 
Although the images have an alpha channel, I can ignore it for the purposes of this function.
Is there an easy-to-implement algorithm or free Java library with this capability?
© Stack Overflow or respective owner