Help me,GIF animation on the merger

PerlMagick is an object-oriented Perl interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning PerlMagick.
Post Reply
gmabrys

Help me,GIF animation on the merger

Post by gmabrys » 2006-12-24T11:58:27-07:00

I have two GIF Animation, namely:

test_pic_1.gif
http://images.blogcn.com/2006/12/26/1/g ... 261744.gif
Image

test_pic_2.gif
http://images.blogcn.com/2006/12/26/1/g ... 261831.gif
Image

How merged into a GIF photo?
I have the following perlcode, but I did not need the results.


Code: Select all

use Image::Magick;
$image1 = new Image::Magick;

$image1->Read('test_pic_1.gif');
$image1->Read('test_pic_2.gif');

$image1->Append(stack=>"");
$image1->Write(filename=>'test_pic_new.gif');
test_pic_new.gif
http://images.blogcn.com/2006/12/26/1/g ... 226199.gif
Image


I need the results are as follows:
test_pic.gif
http://images.blogcn.com/2006/12/26/1/g ... 261935.gif
Image



Seek help. Very grateful!

User avatar
anthony
Posts: 8871
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Post by anthony » 2007-01-02T20:35:47-07:00

The image->Append()
looks like it did not append images side by side (or vertically) but appeand to image sequences (time wise) together.

However even if it did what you requested, you would have just gotten all the images in one long film strip like image.

Currently the only way of doing a side-by-side append of animations (assuming they have the same time sequence, and are fully coaleasced) is to either...

1/ append each animation frames vertically
then append the two vertial sequences together side by side
then tile crop them back into a sequence of images.

2/ save out each animation as seperate frames, (using the script "gif2anim")
append each pair of images side by side
re-form the original animation (using the script "anim2gif")

3/ In a API loop through each frame and append them together to form a new animation

I hope to create soem new '-layers' methods that will also let you append the animations together using alpha compositing.
-shuffle
split a image sequence in two and shuffle together like a stack of cards
-layer composite_pairs
compose each pair of images in the image sequence together.

This however is for the future when I get time to do this.

Quenstion, can I save and use your images as an example, or are they copyright?
Or do you have better 'paired' animations I can use in IM examples?

NOTE the two images will after appending become 'time locked'. where seperated they will also animate separatlly.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/

gmabrys

Post by gmabrys » 2007-01-03T14:24:01-07:00

Thank you!!!!!!!!!!

Appear to be very complicated. This requires a lot of time.

Dependence on too many things(For example:gif2anim,anim2gif...).

There are other more direct way?


P.S.

This is only one example(two GIF Animation).

Application or are three, four, five or more...

Exemple:

test2_pic_1.gif
http://images.blogcn.com/2007/1/4/3/gma ... 445456.gif
Image

test2_pic_2.gif
http://images.blogcn.com/2007/1/4/3/gma ... 445511.gif
Image

test2_pic_3.gif
http://images.blogcn.com/2007/1/4/3/gma ... 445531.gif
Image

test2_pic_4.gif
http://images.blogcn.com/2007/1/4/3/gma ... 445545.gif
Image

Merger Results:

test_pic.gif
http://images.blogcn.com/2006/12/26/1/g ... 261935.gif
Image


Quenstion, can I save and use your images as an example, or are they copyright?


Yes, you can use it as an example.

User avatar
anthony
Posts: 8871
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Post by anthony » 2007-01-03T16:48:49-07:00

I noticed that your animations include part whcih animate acroos the tile boundaries. That is not good idea, and probably should not have been separated in the first place. if you just place the two animations side-by-side on an HTML web page, the two animations will be disjoint time-wise.

Why was it split in this way? I have seen animations like this before and associate it with Japanese teenagers. Does the style have a particular name?

A better way of spliting the animation would be to have a horizontal split for the cat at the top, then a vertical spilt between the bear and the wing, prehaps with a non-animated static image between to make them smaller (though that should not be a problem).

Maybe I need an example of separating an image into tiles, so the various parts animate indepandantally. This image may be a good example for this too, though may be a bit advanced as I also will need to work out a mutli-frame comparision to locate the areas with animations so I can then work out 'cut lines' for the tiles. :-)

As the second part is more complex, I may do it after the first. EG: rejoin the bad split, then split it properly.

All that depends on having time to create new complex IM examples, rather than adding quickie little ones. Currently I am working on my video editing skills to make a reasonable DVD of my wedding (which was two years ago).

Okay back to your problem...
Dependence on too many things(For example:gif2anim,anim2gif...).


The "gfi2anim" and "anim2gif" are some shell script wrappers around IM, that takes an GIF animation (preferably coalesced in this case) and creates a sequence of seperate image files, as well as a special ".anim" file formated as "convert" options to let to recreate the animation exactly as it was. That is the ".anim" will preserve all the timings, offsets and disposal methods that was used in the original animation.

Using these scripts means you can coalesce and dissassemble a GIF animation, append each frame pairs and re-assemble the animation using the same timings.

Later I plan a another script that will merge two ".anim" files with dis-simular time sequences. This would allow you to keep the various parts of the animation separated for 'optimization' purposes. that is animated part A will have separate overlay frames to animated part B. This would be the ultimate 'merge two animations' program, not just an appender, but needs a lot or work to get there.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/

howa

Post by howa » 2007-01-11T03:03:01-07:00

Hello,

I am facing exact the same problem...

after googling for a few hours, i can't find any simple method to merge 2 or more animated gif into a new animated gif (while maintaining the animation)

more help will be great :roll:

my needs are:

1. all of the same size, just overlay them
2. some might have serveral frame, some might have just one frame, or two frame

User avatar
anthony
Posts: 8871
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Post by anthony » 2007-01-11T22:55:25-07:00

The examples using the above images, both appending and re-spliting properly, is now up on IM Examples, Side by Side Appending (time synced)
http://www.cit.gu.edu.au/~anthony/graph ... ns/#append

Enjoy.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/

Post Reply