Page 1 of 1

[Solved] Overlaying image onto animation aligned improperly

Posted: 2011-05-15T22:44:06-07:00
by meridionaljet
Hello,

I'm on Ubuntu 11.04, and am trying to overlay a static blue coastline image onto a geostationary GIF animation with 12 frames using imagemagick.

The code I used to create the composite animation is as follows:

Code: Select all

convert \( animation.gif -coalesce \) null: \( outline.tif -coalesce \) -layers Composite composite_animation.gif
The resulting animation is below:

Image

It's a bit hard to see, but the blue outline should be aligned much farther to the left on the image, but the vast majority of it is cut-off to the right because it is shifted so far. It should be centered. Both the outline and the background are actually cropped regions out of respectively larger images that are identical in size and are designed to be overlaid. If I choose a cropped region farther to the right on the background animation, the cropped blue outline of the same region won't even show up at all after the overlaying, as if it is shifted completely off the screen for some reason.

I have had success overlaying outlines before with the above command, but here it is not working. I tried appending "-gravity center" to the command with no success. If anyone can help, it would be appreciated.

Re: Overlaying image onto GIF animation is aligned improperl

Posted: 2011-05-16T17:15:10-07:00
by anthony
Cropping does NOT remove the virtual canvas offsets. That can be particularly important in animations with frame optimization. See IM examples Animation Modifications, Cropping, and next section Cropping Canvas too.
http://www.imagemagick.org/Usage/anim_mods/#crop

However as your images are probably full-frame animations (equivalent to coalesced, in which case you don't need that option and definitely not for a static single frame image). As such you can just use +repage after your crop to remove the crop offset. See IM Examples, Cutting and Bordering, Crop, Remove Offset
http://www.imagemagick.org/Usage/crop/#crop_repage

Re: Overlaying image onto GIF animation is aligned improperl

Posted: 2011-05-16T17:32:08-07:00
by meridionaljet
anthony wrote:Cropping does NOT remove the virtual canvas offsets. That can be particularly important in animations with frame optimization. See IM examples Animation Modifications, Cropping, and next section Cropping Canvas too.
http://www.imagemagick.org/Usage/anim_mods/#crop

However as your images are probably full-frame animations (equivalent to coalesced, in which case you don't need that option and definitely not for a static single frame image). As such you can just use +repage after your crop to remove the crop offset. See IM Examples, Cutting and Bordering, Crop, Remove Offset
http://www.imagemagick.org/Usage/crop/#crop_repage
This was exactly what I needed. You're a savior. Thanks a lot.

Re: [Solved] Overlaying image onto animation aligned imprope

Posted: 2011-05-17T15:50:31-07:00
by anthony
Can you post a properly working version of the previous example? Just for reference.

I can see why you want to mark the coastline, it seems hard to make out.