help? Is it how motionless? Who can help me !!!!!!

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
axian

help? Is it how motionless? Who can help me !!!!!!

Post by axian »

a.gif:Image
b.gif:Image
Convert a.gif -coalesce -gravity Center -draw 'image Over 0,30 0,0 b.gif' c.gif
Finally :Image
b.gif It is motionless

Image
I want " c1.gif “above equally to move likely
axian

Re: help? Is it how motionless? Who can help me !!!!!!

Post by axian »

I come from China,
My English is not good,
I do not know the meaning of the expression did not clearly!?
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: help? Is it how motionless? Who can help me !!!!!!

Post by anthony »

You basically want to merge two animation sequences.

As one of the sequences is only two frames this should be relativally easy.


First you want to convert the sequences into an animation with the same number of frames over a command 'total cycle time', generally by duplicating frames. when you have the same number of frame you then use -layers composition to compose one sequnce over another sequence. It is the only composition designed with multiple images in mind!

Both -layer composition and animation merging is convered in IM examples, Modifying Animations Though the 'merge' part is not currently exampled with only raw notes.

However if you can provide two SMALLER animations that you like to merge
(one two frame, the other with lots of frames) then I'll use them to demonstrate the 'simpler' case.

The general case with variable time delays is of course a LOT harder in the time synchronization phase.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
axian

Re: help? Is it how motionless? Who can help me !!!!!!

Post by axian »

I am Beginner,
Can give a simple example :(
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: help? Is it how motionless? Who can help me !!!!!!

Post by anthony »

Okay I'll hold your hand a little.

First examine the animations..

Code: Select all

identify a.gif
a.gif[0] GIF 300x343 300x343+0+0 8-bit PseudoClass 128c 33.7kb
a.gif[1] GIF 300x343 300x343+0+0 8-bit PseudoClass 128c 33.7kb
Two frames no frame offsets fully coalesced.

Code: Select all

identify b.gif
b.gif[0] GIF 32x32 32x32+0+0 8-bit PseudoClass 64c 2.93kb
b.gif[1] GIF 32x31 32x32+0+0 8-bit PseudoClass 64c 2.93kb
b.gif[2] GIF 32x30 32x32+0+1 8-bit PseudoClass 64c 2.93kb
b.gif[3] GIF 32x31 32x32+0+0 8-bit PseudoClass 64c 2.93kb
b.gif[4] GIF 32x30 32x32+0+1 8-bit PseudoClass 64c 2.93kb
b.gif[5] GIF 32x31 32x32+0+0 8-bit PseudoClass 64c 2.93kb
6 frames, some offsets!!!

Lets ignore the timings and reset teh frame delays completely later. That means we just need to merge 6 frames with 6 frames, but the first animation only has 2 frames. Simple to fix, duplicate each frame to produce 6 frames...

Code: Select all

convert a.gif -coalesce \( -clone 0,0,1,1,1 \) -delete 1 
That makes the first animation 6 frames (the first frame 3 times followed by the second frame 3 times)

Now add our image list separator image that -layers composite needs.

Code: Select all

null:
and then read and coalesce the second animation...

Code: Select all

\( b.gif -coalesce \)
Now lets sets the gravity/geometry offsets and overlay the 6 'b' frames onto the 'a' frames...

Code: Select all

-gravity Center -geometry +0+80 -layers composite
fix the timing deleys, optimize, and save

Code: Select all

-set delay 30 -loop 0 -layers optimize c.gif
Putting it all together...

Code: Select all

convert a.gif -coalesce \( -clone 0,0,1,1,1 \) -delete 1 \
   null:  \( b.gif -coalesce \) \
   -gravity Center -geometry +0+80 -layers composite \
   -set delay 30 -loop 0 -layers optimize c.gif
Result...
Image

Read IM Examples for more. I would love to put the above in IM examples, but the rabbit is too big! Anyone have anything smaller?
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
axian

Re: help? Is it how motionless? Who can help me !!!!!!

Post by axian »

Thank you very much!
User avatar
balamm
Posts: 4
Joined: 2009-08-22T11:02:08-07:00
Authentication code: 8675309

Re: help? Is it how motionless? Who can help me !!!!!!

Post by balamm »

Here's an example you're welcome to use on your examples page Anthony.

I'll leave the IM command structure to you ;)

This lippy little guy is 64 frames, various delays.
Image

The animated flag consists of 8 frames, all delays .06
Image

This minimally optimised Image is now 200 frames, which is divisible by 8, the number of frames in our second animation
200/8 = 25. We need 25 repetitions of the flag animations to synch up the 2 animations.
Image
All 200 frames now have a .06 delay and both animations start and end at the same time.


In this case, I did the splitting and duplications manually to arrive at a consistant delay for all frames.

Anthony, can you maybe break this part down so it's easier to understand?

Code: Select all

convert a.gif -coalesce \( -clone 0,0,1,1,1 \) -delete 1 
I think this part in particular is a bit difficult to understand for new coders or non coders.

Code: Select all

\( -clone 0,0,1,1,1 \)

It should be noted that any frame delay lower than .06 will default to .10 in Internet Explorer (at least up to version 6)

For the greatest flexibility, I always build these with a .06 delay rate.
Anything higher limits the possible division points.

ie: with a delay of .06,
(let's make this easier to understand and drop the points and zeros...)
the possible divisions (frame delays) are
6, 12, 18, 24, 30, 36, etc.

If we use a .12 delay, the only possible divisions are now
12, 24, 36, etc.


In this case, we have several frames in the "smiley" that need to be addressed before we can begin duplicating the flag animation.
Frame #1 has a delay of 120
Frame #16 has a delay of 120
Frames #19 through 22 have a delay of 12
Frame #23 is 66
Frame #24 is 12 again
and so on.

So all of these seem to be divisible by 6.

We need to divide all of these frames into our lowest possible common frame rate, in this example, .06

120/6 = 20. We need 20 duplicate frames to replace frame #1, all with a .06 delay, to maintain the smiley's pause without stopping the flag animation.

In the event that a frame delay is not divisible by our lowest common delay, then it needs to be rounded to a divisible number before splitting and duplicating.
ie:
a frame rate of .10 can be rounded to 12 ,then divided into 2 identical .06 frames.
a frame rate of 8 or 9 can be rounded to 6 (or 12 then divided into 2 identical .06 frames).
a frame rate of 17 can be rounded to 24, then into 4 identical .06 frames.

Knowing whether to round up or down depends on the animation itself and your own experience with the particular type of animated image.

Here's a few more examples, some of them with up to 5 disjointed animations all merged into a single animation.

Image Image Image Image Image Image

Multiple Animation Layer Combiner Is Available For Use At:
http://www.smileygenerator.us/animation ... /index.php

I've even done a few "Crosseye 3D" examples using merged animations like this but I'll leave that technique for another discussion ;)

Cross your eyes slightly and focus on the center image that appears. Looks much better on a dark background!
Image
http://www.smileygenerator.us/smileygen ... /index.php
Last edited by balamm on 2013-03-23T20:02:12-07:00, edited 5 times in total.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: help? Is it how motionless? Who can help me !!!!!!

Post by anthony »

I am glad you have it sorted out now.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
balamm
Posts: 4
Joined: 2009-08-22T11:02:08-07:00
Authentication code: 8675309

Re: help? Is it how motionless? Who can help me !!!!!!

Post by balamm »

Just a follow up on the problem of IE incorrectly displaying animations and delays, it would appear that animators, coders, and end users viewing these images, just aren't of concern to the IE developers.

I was involved with MS in the late stages of XP development and in server 2003 and this issue was well known to them at that time as well. Image
Since this bug only occurs in Internet Explorer, and since the GIF file format is one of three key standard compliant image formats for the web, it would be great if you could fix this in IE 8 as you’re currently perfecting all the loose ends in the IE rendering engine, and it should be pretty simple to fix as well as keeping IE 8 up to par with the other three main competing browsers that don’t have this issue.
Thank you for this feedback.

At this time we do not plan on fixing this issue in the IE8 time frame. We appreciate the report, but unfortunately we are at a stage where need to choose what we work on to maximize the value for customers and web developers.

We will track the issue and hope to address it in a future version of IE.

Best Regards,

The IE Team
Quoted From:
http://connect.microsoft.com/IE/feedbac ... kID=368081
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: help? Is it how motionless? Who can help me !!!!!!

Post by anthony »

Actually of bigger concern is that IE and every other browser fails to handle 'zero delay' type frames efficiently. See Zero Delay Intermediate Frames...
http://www.imagemagick.org/Usage/anim_basics/#zero

Usually such frames are created for file size optimization reasons.
See Frame Doubling Optimization, onward....
http://www.imagemagick.org/Usage/anim_opt/#doubling


That is if some animation with time delays has a 'zero delay' frame, then just apply that frame as normal, and skip to the next frame immediatally, it does not even have bother displaying that frame (it is displayed for zero time!)

See the first link above for my notes about what various programs do. Internet Explorer appears to add a delay to ALL frames!!! Maybe this is that 6 centi-seconds
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
balamm
Posts: 4
Joined: 2009-08-22T11:02:08-07:00
Authentication code: 8675309

Re: help? Is it how motionless? Who can help me !!!!!!

Post by balamm »

Well, it's only taken IE 14+ years to recognise that pngs should display with transparency.... so Maybe in another 14 years or so they'll address this gif delay issue as well. Image


MS....
Image
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: help? Is it how motionless? Who can help me !!!!!!

Post by fmw42 »

PC -- does that stand for [P]iece of [C]rap? :wink: (sorry I could not resist)
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: help? Is it how motionless? Who can help me !!!!!!

Post by anthony »

One thing to take into account is that MS Windows is deliberately
designed to cripple your hardware, so that you keep upgrading
(hardware and software), which means you are being asset-stripped.
-- Ron Savage

Windows is a 32 bit patch to a 16 bit GUI based on a 8 bit
operating system written for a 4 bit processor by a 2 bit
company which can not stand 1 bit of competition.

Friends don't let friends do DOS; Linux to the rescue!

Sorry could not resist that.

However we have had recent confirmation that Internet Explorer version 8 also fails if any frame extends beyond the animation bounds set by the first frame.
That is it will just ignore that frame onward!
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: help? Is it how motionless? Who can help me !!!!!!

Post by fmw42 »

a 2 bit company which can not stand 1 bit of competition.
Love It! Nice! Got a laugh! :lol:

They also sucker the less computer savvy into buying because it is cheap and you get what you pay for! ("I'm four years old and I'm a PC")

Then you have to pay the Geek squad hundreds of dollars to fix your registry corruption or viruses that get by many anti-virus and anti-spam software because they cannot make patches fast enough. So you pay more in the long run or give up on your computer because it is unusable if you don't pay to get it fixed. ( I have helped a neighbor with a PC over the last couple of years to remove about 8 viruses that were imitating antivirus software and so probably saved him on the order of $1000 in repair bills).

(Sorry about the PC bashing. Personal opinion. But I am sure there are pros and cons to Linux and Mac as well. Just feel sorry for the greater majority out there that have to put up with all the malicious people and behavior).
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Final Summery of Solution.

Post by anthony »

In summery the method described above in is a LIMITED SOLUTION, but one that works well for most 'fast changing' animations.

The solution takes each animation and expands it so that the animation has a fixed frame rate. That is frames are 'cloned' or duplicated so that each frame is shown for 6 centi-seconds each. As such one frame with a 22cs delay may be replaced by 4 x 6cs frames (24cs total).

After this the animations are further modified so that short animations are looped multiple times so that the two animations are finally of equal length. That is the two animations are made the same overall length in terms of both time, and number of frames.

So optimizations may be to remove one or two duplicate frames from animations that have long periods of duplicate (no activity) frames, to help with the time/frame equalization.

Once both animations has the same frame-rate and the same length, Layer Composition can be used to merge/overlay the two animations, in the right position.

Once merged you can Remove Duplicate Frames and other Optimizations applied before saving.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply