Stupid blending question....

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
marclallen

Stupid blending question....

Post by marclallen »

Hi, guys... new to IM, trying to create a blending animation...

The basic command I'm using is:

convert -delay 100 a.png -alpha off -alpha set
\( -clone 0 b.png -alpha off -alpha set -compose blend -set "option:compose:args" 0 -composite \)
\( -clone 0 b.png -alpha off -alpha set -compose blend -set "option:compose:args" 20 -composite \)
\( -clone 0 b.png -alpha off -alpha set -compose blend -set "option:compose:args" 40 -composite \)
\( -clone 0 b.png -alpha off -alpha set -compose blend -set "option:compose:args" 60 -composite \)
\( -clone 0 b.png -alpha off -alpha set -compose blend -set "option:compose:args" 80 -composite \)
\( -clone 0 b.png -alpha off -alpha set -compose blend -set "option:compose:args" 100 -composite \)
-delete 0 -loop 0 -layers Optimize test2.gif

It's supposed to take a.png and transition to b.png over six total images. What I get are six identical images with a.png and b.png merged, each at 100%.

So, two questions:

1) Obviously, I'm missing something stupid. But, what?
2) Is there a better/easier way for me to accomplish the task?

I'd like answers to both questions, if possible, so I can learn where I went wrong as well as any better methods.

Thanks,

Marc
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Stupid blending question....

Post by Bonzo »

Is morph what what you are looking for ?
Image

This is some php code and only uses two images as I wanted to keep the file short.

Code: Select all

$cmd = "morph/path.jpg morph/view.jpg -morph 12";
exec("convert $cmd morph.gif");
 
marclallen

Re: Stupid blending question....

Post by marclallen »

Whoa! That's exactly what I want. Thanks so much.

I'd still like to know why my example didn't do what I expected, though. Any thoughts?

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

Re: Stupid blending question....

Post by fmw42 »

I think you want to remove -alpha set. That just turns on transparency and probably messes up the blend.
marclallen

Re: Stupid blending question....

Post by marclallen »

I wish. I tried it all possible ways. No luck. Originally, I didn't have any alpha commands, so that seemed like an obvious candidate. No alpha channel, no blend transparency. I ended up with what you see because "-alpha opaque" didn't register... it might be newish, and I have 6.3.something.

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

Re: Stupid blending question....

Post by fmw42 »

you need 6.5.3-4 to use -set with convert -blend

use composite -blend if older than this version, in general, but I don't think it works within parentheses

see

http://www.imagemagick.org/Usage/compose/#blend
http://www.imagemagick.org/script/comma ... hp#compose
marclallen

Re: Stupid blending question....

Post by marclallen »

Ah! I thought that might be it. I looked, but did not find any comment to that effect. The author is usually pretty good about that.

Yeah... I don't think composite can be used within a convert, since it is its own program.

Thanks again,

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

Re: Stupid blending question....

Post by fmw42 »

from http://www.imagemagick.org/script/comma ... hp#compose

As of IM v6.5.3-4 the "convert" command can now also supply these extra arguments to its -composite operator, using the special -set attribute of 'option:compose:args'. This means you can now make use of these special argumented -compose methods, those the argument and the method both need to be set separatally
marclallen

Re: Stupid blending question....

Post by marclallen »

Thanks!

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

Re: Stupid blending question....

Post by fmw42 »

if interested, see my scripts fxtransitions, shapemorph and transitions
Post Reply