Reputation: 664
I have an animated gif
image with transparent frames.
I need to resize it.
Before resizing, I use the Magick::coalesceImages
function, after I resize the image I use the Magick::writeImages
function to collect all the gif
frames back into one single image.
The problem is that the output resized image file size is bigger than the original one, because the original animated gif
had transparent frames, and the new resized gif
does not have any transparent frames.
I have read about frame optimization on www.imagemagick.org plus I can see on www.graphicsmagick.org the gifDisposeMethod
function.
My question is, how can I cause the resized animated gif
image to use transparency frames and avoid the increase on the image KBytes
size?
Upvotes: 3
Views: 2773
Reputation: 664
Well, I found the way to go:
When resizing an animated gif
, using Magick::coalesceImages()
is not the best way...
Instead I am rezising according to percentage sizing and not absolute sizing, while skipping the Magick::coalesceImages()
call.
For example, lets say my original animated gif
is 300x300 and I want to resize it to be 150x150, I'll do the following:
Magick::Blob
This way we are not increasing each frame size because we are not using the Magick::coalesceImages()
function and we are resizing each frame according to its original size, so we don't have any problem with the transparency of the frame.
Upvotes: 3