C++ Interface, create and append to gif file
Posted: 2016-05-04T13:25:31-07:00
I'm a new imagemagick user, and currently in the process of converting a lot of my matlab code base into c++ for speed reasons. One of the tasks I need to complete is writing gif animations from RGB data, frame-by-frame, by appending the latest data to an existing file.
In matlab, this could be done with a line like this:
imwrite(imageData, colormap, filename, 'gif', 'WriteMode', 'append');
Looking at the ImageMagick++ documentation, it appears that animated files are expected to be written as one cumulative write using the STL interface.
The reason I'm doing this is because my animations are ambiguously long, depending on the raw data file being used to generate the animations. Sometimes animations can have >10000 frames, and I would prefer to offload data to disk instead of accumulating data in a container of Image variables. Since there aren't many pixels that actually change frame-to-frame and the color depth is limited, I expect the raw pixel data size in memory to be much larger than the resultant gif file.
In matlab, this could be done with a line like this:
imwrite(imageData, colormap, filename, 'gif', 'WriteMode', 'append');
Looking at the ImageMagick++ documentation, it appears that animated files are expected to be written as one cumulative write using the STL interface.
Instead of storing multiple images inside of a container, is it possible to use a single Image object to keep track of the latest pixel data, and use the some Image:: method(s) to first create a .gif file with some animation properties and then later append new data to the existing .gif file with the same Image object?...The STL interface must be used to operate on image sequences or images (e.g. of format GIF, TIFF, MIFF, Postscript, & MNG) which are comprized of multiple image frames...
The reason I'm doing this is because my animations are ambiguously long, depending on the raw data file being used to generate the animations. Sometimes animations can have >10000 frames, and I would prefer to offload data to disk instead of accumulating data in a container of Image variables. Since there aren't many pixels that actually change frame-to-frame and the color depth is limited, I expect the raw pixel data size in memory to be much larger than the resultant gif file.