Hi,
I'm generating the following image using an STL list and the writeImages() method in order to create the animation.
I am generating each frame as I go.. then when I'm done generating, writeImages() iterates through the list again to write all of the frames to one image. Is there a way I can have a master Image that I can append images to it as I generate the frames?
I just don't like it that I have to reiterate through the list in order to write the image. I keep on searching for an append() method.. so I can simply do the following pseudo code:
masterImage.adjoin(true);
// a loop that generates each frame goes here
masterImage.append(/* image frame in here */); // I know this method doesn't exist.. just bear with me
// end of loop
masterImage.write("filename.gif");
I feel like because I have to iterate through the list in order to write the image that I'm gaining unwanted execution time.
Any ideas?
(I'm looking for a Magick++ solution not a command-line solution, thanks
What is the best way to adjoin images?
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
When your animation is finished run it though a "-coalesce -layers optimize" sequence to compess the GIF file down a massive amount. This type of GIF animation will compress extremely well.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Nevermind, I see that the -layers optimize was simply cropping my frames into little gifs and paging them to the image. I just modified my code to do the following and the image size is just as small (if not smaller) than what was being produced from 'convert -coalesce -layers optimize' and it does it in about 0.1% of the time
Thanks again!
Thanks again!
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Yes that is all it does. GIF animation optimisaions only becomes complex when you need to 'clear' pixels to transparency afterward, or you have color reduction problems. Neither is the case for you so you have it easy.
Just output the changed part with the right virtual canvas or 'page' offset and you will be right.
See IM examples Animation Basics for more details of GIF animation, how it happens and handling it.
Just output the changed part with the right virtual canvas or 'page' offset and you will be right.
See IM examples Animation Basics for more details of GIF animation, how it happens and handling it.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/