Caption and animated gif problem.

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
whisller
Posts: 2
Joined: 2011-07-22T03:54:00-07:00
Authentication code: 8675308

Caption and animated gif problem.

Post 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? :/
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Caption and animated gif problem.

Post 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 ( )
whisller
Posts: 2
Joined: 2011-07-22T03:54:00-07:00
Authentication code: 8675308

Re: Caption and animated gif problem.

Post 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 :)
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Caption and animated gif problem.

Post 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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply