Hello,
I just installed IMagick and was wondering if there is a way to watermark and resize animated gifs.
Best,
Ackergaul
Watermarking Animated Gifs
Re: Watermarking Animated Gifs
Hello,
sure! you just need to execute the operations on every frame:
sure! you just need to execute the operations on every frame:
Code: Select all
$im = new Imagick("test.gif");
foreach ($im as $frame) {
// resize and watermark $frame here
}
$im->writeImages( ...
Mikko Koppanen
My blog: http://valokuva.org
My blog: http://valokuva.org
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Watermarking Animated Gifs
If you want to compose on every frame you should be able to use the multi-image
CompositeLayers() function. This should take two images lists whcih it alpha composes together. if one of the images is only a single image that image is applied to ALL the images of the other list.
I implemented this for Command Line (-layers composite), but it should be available for other API's by this time.
WARNING: for GIF animations be sure to Coalesce the animation to remove any optimizations thet may be present, or unexpected results may occur.
After processing you can use the functions OptimizeImageLayers() for frame disposal optimization, and then OptimizeImageTransparency() for to make it compress better.
See the three sections on GIF Animations, in the Command Line API usage guide, IM Examples. They are recommended reading for anyone doing GIF animation work.
http://www.imagemagick.org/Usage/
CompositeLayers() function. This should take two images lists whcih it alpha composes together. if one of the images is only a single image that image is applied to ALL the images of the other list.
I implemented this for Command Line (-layers composite), but it should be available for other API's by this time.
WARNING: for GIF animations be sure to Coalesce the animation to remove any optimizations thet may be present, or unexpected results may occur.
After processing you can use the functions OptimizeImageLayers() for frame disposal optimization, and then OptimizeImageTransparency() for to make it compress better.
See the three sections on GIF Animations, in the Command Line API usage guide, IM Examples. They are recommended reading for anyone doing GIF animation work.
http://www.imagemagick.org/Usage/
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/