Compositing text on animated gif thickens

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
coopermj
Posts: 3
Joined: 2015-01-23T10:40:15-07:00
Authentication code: 6789

Compositing text on animated gif thickens

Post by coopermj »

I have an animated gif: http://imgur.com/4GhaC8E (let's call it double-blanked.gif)

I would like to put text on the frames, so first I create a transparent image with text:
convert -size 106x73 -background none -fill "#0f0f0e" -font "./sign-standard.ttf" -gravity center -pointsize 18 label:"CHANGE\nMANAGEMENT\nPROCESS" sideout.miff

Then I perspective distort the text:
convert sideout.miff -distort Perspective "0,0 0,0 0,73 0,73 106,0 96,13 106,73 96,79" sidedistorted.miff

Then I attempt to compose the text onto it (I've tried png as well as miff with the same results):
convert double-blanked.gif null: sidedistorted.miff -geometry "+515+94" -layers Composite sidewith_background.gif

The result has a flicker: http://imgur.com/fKpgQ5n

Frame 1 has text that is thinner than subsequent frames. If I add -layers Optimize, then the text gets gradually thicker each frame.

How do I compose consistently across all the frames?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Compositing text on animated gif thickens

Post by fmw42 »

coopermj
Posts: 3
Joined: 2015-01-23T10:40:15-07:00
Authentication code: 6789

Re: Compositing text on animated gif thickens

Post by coopermj »

Thanks for replying!

I tried using -draw, but I'm not sure how the syntax works.

convert double-blanked.gif -draw 'image over 515,94 sidedistorted.miff' out.gif
and
convert double-blanked.gif -draw 'image over 515,94 sidedistorted.miff "sidedistorted:"' out.gif
both give me
convert: non-conforming drawing primitive definition `image' @ error/draw.c/DrawImage/3170

I tried
convert double-blanked.gif -draw 'image over 515,94 0,0 sidedistorted.miff "null:"' out.gif
convert: non-conforming drawing primitive definition `null:' @ error/draw.c/DrawImage/3170

convert double-blanked.gif -draw 'image over 515,94 0,0 "sidedistorted:"' out.gif
-- just doesn't respond
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Compositing text on animated gif thickens

Post by fmw42 »

Perhaps you can provide your transparent text image, so we can use it to test -draw with your animation

The -draw syntax is image compose x,y width,height 'filename' Though usually the width and height can be set to 0. See http://www.imagemagick.org/script/magic ... aphics.php

Only IM internal images (like rose: and logo:) use the colon :. All other images must have its proper suffix provide (and no colon) and if needed the path to the image file. See http://www.imagemagick.org/script/forma ... tin-images
coopermj
Posts: 3
Joined: 2015-01-23T10:40:15-07:00
Authentication code: 6789

Re: Compositing text on animated gif thickens

Post by coopermj »

Oh, man, I didn't realize rose: was internal. I'm such a newb. I couldn't figure out at all how it was picking up the rose image! That answer alone has added to my sanity.

Okay, so I still have the flickering problem and now I have a duplication issue.

Here are my files:
convert -size 106x73 -background none -fill "#0f0f0e" -font "./sign-standard.ttf" -gravity center -pointsize 18 label:"FRED'S\nIMAGEMAGICK\nSCRIPTS" sideout.png -> http://i.imgur.com/KfzfbUD.png

convert sideout.png -distort Perspective "0,0 0,0 0,73 0,73 106,0 96,13 106,73 96,79" sidedistorted.png -> http://i.imgur.com/8s9PY40.png

double-blanked.gif from http://imgur.com/4GhaC8E

convert double-blanked.gif -draw 'image over 515,94 0,0 sidedistorted.png' out.gif -> http://i.imgur.com/d9ZRhc1.gif

Thanks!
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Compositing text on animated gif thickens

Post by snibgo »

Each image in a gif file is typically a delta, just showing differences. Any operation on each delta is almost certainly not what you really want. You want to operate on each image as a proper, standalone image, like a real photograph.

To convert from deltas to "real" images, use "-layers coalesce" after reading the gif. To convert back to deltas, use "-layers optimize" before writing it.

See "animation" under http://www.imagemagick.org/Usage/
snibgo's IM pages: im.snibgo.com
Post Reply