Page 1 of 1

Caption and animated gif problem.

Posted: 2011-07-22T04:14:21-07:00
by whisller
Hi guys,
it is my first post on your board so please for charity :)

I have used imagemagick with successfully in my PHP application, but now I have a problem with animated gifs. In my application I have used imagemagick for php and it works fine.

I am using it to create images with text specified by user - it is basing on "annotate". I also tried to use it with animated gifs and also works pretty nice, one problem was that it is killing my server ;)

So I have thought about use imagemagick right by console. And here is a problem, because it doesn't work properly with "caption" and animation gifs - it does not work :)

I need to use "caption" because I want to wordwrap text from the user.

With annotate

Code: Select all

convert myimage.gif \
\( -clone 0 -coalesce -gravity South -background none -size 435x65.5 -annotate 0 "Only example" \) -swap -1,0 \
a3.gif
Image

And with caption

Code: Select all

convert myimage.gif \
\( -clone 0 -coalesce -gravity South -background none -size 435x65.5 caption:"It does not work..." \) -swap -1,0 \
a3.gif
Image

I have tried something else but effect also isn't good - position is bad, and text is shows only in couple of frames

Code: Select all

convert  myimage.gif -clone 0 -coalesce \
\( -swap -1,0 -background none -fill white -size 435x65.5 -fill '#ffffff' -stroke black -strokewidth 1 -font Courier-Bold -gravity center \
caption:"Test1" \) -clone 0 -coalesce -gravity north -swap -1,0 \
\( -swap -1,0 -background none -fill white -size 435x65.5 -fill '#ffffff' -stroke black -strokewidth 1 -font Courier-Bold -gravity center \
caption:"Test2" \) -clone 0 -coalesce -gravity south -swap -1,0 a4
Image

Any idea how to use caption with animated gifs? :/

Re: Caption and animated gif problem.

Posted: 2011-07-22T04:37:00-07:00
by Bonzo
I did some word wrap tests and the results are here: http://www.rubblewebs.co.uk/imagemagick/notes/wrap.php
As you can see you can "force" word wrap with annotate; if your font is always the same size could you use wordwrap ( )

Re: Caption and animated gif problem.

Posted: 2011-07-22T04:43:55-07:00
by whisller
No it has a dynamic pointsize :) For annotation I have a whole class for dynamic setup font size based on "queryFontMetrics". So "wordwrap" will do not help me :)

Re: Caption and animated gif problem.

Posted: 2011-07-22T06:55:32-07:00
by anthony
It is tricy as your GIFS may be optimized, and this is interfering with the results.

This problem is looked at in IM Examples
Appending a label
http://www.imagemagick.org/Usage/anim_mods/#label

Basically, you should remove optimizations first, add your caption, then get IM to re-optimize your GIF animations.