usage contribution: example ming animation

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
Loo
Posts: 6
Joined: 2012-03-19T15:33:36-07:00
Authentication code: 8675308

usage contribution: example ming animation

Post by Loo »

The following is a link to an example of a simple ming animation for http://www.imagemagick.org/Usage/formats/ where is says "A simple example of using MNG is wanted, so if you have one mail me."

http://dl.dropbox.com/u/68982373/im_usa ... te_hue.mng

It works with 'animate rose_modulate_hue.mng'; however, my web browser (Firefox) apparently abandoned MNG in favor of APNG back in 2008. I'm not sure how to handle that, so I'm just sending the example image this time.

I'm open to all types of feedback, including the best process to get changes submitted, file naming conventions, ect.

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

Re: usage contribution: example ming animation

Post by fmw42 »

It is a nice animation. I can view it with animate image.mng

However, when creating examples for Anthony's Examples Pages, I think he would also appreciate having the command line(s) used to create the image. But he can explain further.
Loo
Posts: 6
Joined: 2012-03-19T15:33:36-07:00
Authentication code: 8675308

Re: usage contribution: example ming animation

Post by Loo »

It was created using the following commands in bash:

convert rose: /tmp/rose.png

for m in 0 1
do
for i in {0..9}; do
for j in 1 3 5 7 9; do
# modulate hue
convert /tmp/rose.png -modulate 100,100,${m}${i}${j} /tmp/rose_${m}${i}${j}.png
done
done
done

convert /tmp/rose_???.png -delay 1x30 rose_modulate_hue.mng
rm /tmp/rose_???.png /tmp/rose.png
Loo
Posts: 6
Joined: 2012-03-19T15:33:36-07:00
Authentication code: 8675308

Re: usage contribution: example ming animation

Post by Loo »

I did a lot more reading on mng support in web browsers. It's apparently dead, or at least nearly dead. There may be occasional twitching of it's corpse, but that's mostly nerves. Which is a shame, because it seemed like a neat, useful format.

Anyway, I propose moving mng to the bottom of the Usage/formats page along with "Other Image File Formats", giving it a brief description followed by a comment on browser support, and finally a "click here to download mng sample" link instead of trying to display directly on the Web site.

I, of course, will do the work; but, I'm not certain what you guys think should be done, so I'll wait for comments.

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

Re: usage contribution: example ming animation

Post by anthony »

fmw42 wrote:It is a nice animation. I can view it with animate image.mng

However, when creating examples for Anthony's Examples Pages, I think he would also appreciate having the command line(s) used to create the image. But he can explain further.
Thank you for the example file.

The example I need for IM Example is an example of the command line, not the final result

Like you mentioned browsers today are abandoning the MNG animation format, but it does not look like IM as yet understands the APNG format. Perhaps Glenn can shead more light on this.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Loo
Posts: 6
Joined: 2012-03-19T15:33:36-07:00
Authentication code: 8675308

Re: usage contribution: example ming animation

Post by Loo »

Here's my attempt #2, this time without bash. Also, I went ahead and wrote some text for it, too. Let me know what you think, and I'll post and HTML patch.

Here's a link to the example image:
http://dl.dropbox.com/u/68982373/im_usa ... t_anim.mng

Here's the text for the Web site:
MNG (Multiple-image Network Graphics)
MNG (pronounce ming) is an open format based on PNG, and provides an animated bitmap alternative to GIF and others. It allows for transparency (both semi and full), compression (both lossy and lossless), and up to 32-bit color depth.

The increased color depth is what really sets this format apart from others. GIF only supports up to 256 colors total, which is fine for many graphics; however, photographs and gradients will suffer.

Most animation options that can be used in creating GIF animations can also be used to create MNGs.

convert -size 101x101 radial-gradient:#F00-#000 \
-page +5+5 -size 91x91 radial-gradient:#F12-#000 \
-page +10+10 -size 81x81 radial-gradient:#F24-#000 \
-page +15+15 -size 71x71 radial-gradient:#F36-#000 \
-page +20+20 -size 61x61 radial-gradient:#F46-#000 \
-page +15+15 -size 71x71 radial-gradient:#F36-#000 \
-page +10+10 -size 81x81 radial-gradient:#F24-#000 \
-page +5+5 -size 91x91 radial-gradient:#F12-#000 \
-set delay 1x30 -loop 0 final.mng

The above command generates eight radial-gradient images centered on top of each other, and displays each frame at 1/30th of a second. The odd sizes give us a center pixel to ensure each frame lines up exactly. The #FXX numbers shifts the colors from a pure RGB red to a greenish-bluer one and back.

Unfortunately, most Web browsers do not currently support MNG. If you click on the above missing image frame, you can download the animation and view it using "animate".

For more information on the MNG format, visit http://www.libpng.org/pub/mng
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: usage contribution: example ming animation

Post by anthony »

Loo wrote:Here's my attempt #2, this time without bash. Also, I went ahead and wrote some text for it, too. Let me know what you think, and I'll post and HTML patch.
I have added this to IM Examples, with reference to you as contributer, and to this forum discussion.
May take a bit of time to appear at
http://www.imagemagick.org/Usage/formats/#mng

It is basically as you have given with only the addition...
.... and many video players only show one pass though the looped animation.

Code: Select all

convert -size 101x101 radial-gradient:#F00-#000 \
	-page +5+5 -size 91x91 radial-gradient:#F12-#000 \
	-page +10+10 -size 81x81 radial-gradient:#F24-#000 \
	-page +15+15 -size 71x71 radial-gradient:#F36-#000 \
	-page +20+20 -size 61x61 radial-gradient:#F46-#000 \
	-page +15+15 -size 71x71 radial-gradient:#F36-#000 \
	-page +10+10 -size 81x81 radial-gradient:#F24-#000 \
	-page +5+5 -size 91x91 radial-gradient:#F12-#000 \
	-set delay 1x30 -loop 0 final.mng
I am certain this could be improved! using level and level colors.
Hmmm...

Code: Select all

convert -size 101x101 radial-gradient: \
	\( -clone 0 -level 00,100% +level-colors ,#F00 \) \
	\( -clone 0 -level 10,100% +level-colors ,#F12 \) \
	\( -clone 0 -level 20,100% +level-colors ,#F24 \) \
	\( -clone 0 -level 30,100% +level-colors ,#F36 \) \
	\( -clone 0 -level 40,100% +level-colors ,#F46 \) \
        -delete 0  -duplicate 1,-2-1 -set delay 1x30 -loop 0 pulsing.mng
that last line removed the greyscale source image, duplicates the frames (except fo rthe ends) to create a 'patrol cycle'
http://www.imagemagick.org/Usage/anim_mods/#reverse
before giving the final animation settings.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: usage contribution: example ming animation

Post by anthony »

Another method may be to just create the first and last frames, then use -morph to generate a color morph linearly between the two frames.
http://www.imagemagick.org/Usage/anim_mods/#morph

Code: Select all

convert -size 101x101 radial-gradient: \
        \( -clone 0 -level 00,100% +level-colors ,#F00 \) \
        \( -clone 0 -level 40,100% +level-colors ,#F46 \) \
        -delete 0  -morph 3  -duplicate 1,1--2 -set delay 1x30 -loop 0 pulsing.mng
But it does not look right as it just 'fades' the outside colors rather than scale it to as to 'pulse' :-(

However I do like your 'Hue' animation, and would love to see what you did to generate it.

It would make a good example when I (or Fred) finaly get around to creating a 'constant intensity hue roll' as per the HSL wikipedia page methioned previously.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Loo
Posts: 6
Joined: 2012-03-19T15:33:36-07:00
Authentication code: 8675308

Re: usage contribution: example ming animation

Post by Loo »

Wow. I suppose I should read ALL the documentation before submitting more examples. My dog, Lexi the Destroyer of Things, stomped my laptop screen into half an oblivion, and I'm going to a five-week training course for work, so you won't hear from me for a little while, but I'll continue working of the formats page (and then the others) eventually.

The shell code (bash) for the hue shifting rose is a few replies above. I can't repost because the aforementioned laptop screen.

Thanks for your time; it'll pay dividends in the future.

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

Re: usage contribution: example ming animation

Post by anthony »

Loo wrote:Wow. I suppose I should read ALL the documentation before submitting more examples.
No problem if you do or you don't. that is what the forum is about. Mind you I have been doing this for years so I have come to know the insides (literally, I'm not programming new code) of ImageMagick!

My dog, Lexi the Destroyer of Things, stomped my laptop screen into half an oblivion.
Is this the same dog that ate your homework in school?
and I'm going to a five-week training course for work, so you won't hear from me for a little while, but I'll continue working of the formats page (and then the others) eventually.
Enjoy. :-)
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply