How to make watermarking of frames faster

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
gudata

How to make watermarking of frames faster

Post by gudata »

Hello,
I have a folder where I have unoptimized frames generated from a gif file. Now I want to put back those frames but with a watermark.
I expect to have a gif file at the end with all frames (each frame with a watermark).

Also I think(hope) that doing this with one command will be much faster than just stamping every frame on separate folder, and then putting them back to gif.

here is what I tried.

Code: Select all

convert temp/??.png null:  watermark.png  -gravity south  -layers composite  ani.gif
This takes 20 seconds and for sure I will be killed by my boss if put this on-line :(

The strange thing is that almost the same images on the /png folder (which are bigger) tooks only 1sec.
  • temp/??.png + watermarkng -> 20sec
    png/??.png + watermarkng -> 1sec
What I am doing wrong with the 20sec image generation?


Here is the zip file with all the images http://gudasoft.com/dl/zip.zip
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How to make watermarking of frames faster

Post by fmw42 »

I am not an expert animatios. But I don't think you can do it faster. You probably need a faster computer or with more memory so you don't thrash to disk. You never said how big the files were nor how many frames.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: How to make watermarking of frames faster

Post by magick »

GIF is restricted to 256 colors and the color reduction portion of your workflow is consuming most of the time. In our tests, we saved to the MIFF image format in 0.25 seconds, whereas the GIF format required 11 seconds.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: How to make watermarking of frames faster

Post by anthony »

You may be able to quantize the images to a common colormap first! That should make it a lot faster.

Hmmm checking the zip... the "png" directory images are already color reduced, so IM does not need to do this. BUT the "temp" images are resized and have lots of colors, and thus needs a lot of color reduction before they can be saved a GIF.

You may like to look at PNG color recudion programs, such as
pngquant
http://www.libpng.org/pub/png/apps/pngquant.html
pngnq
http://www.cybertherial.com/pngnq/pngnq.html
pngout -- Windows specific - a compressor with 8 bit pallet options
http://www.advsys.net/ken/utils.htm

Other than that you must remember IM is a general image processor designed with a LOT of image file formats. Pallette images are not its forte. You may be able to do more with a specific GIF animation program though you won't do much else.

Free ones include...
InterGIF
http://utter.chaos.org.uk/~pdh/software/intergif.htm
Gifsicle
http://www.lcdf.org/gifsicle/


however I have tried these programs (though it was more than four years ago) and found both to have some problems with some specific types of GIF animations.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
gudata

Re: How to make watermarking of frames faster

Post by gudata »

Thank you very much for the responses!

Will try and give feedback.
Post Reply