IM 6.7.7.6 Q16 Mac OSX Snow Leopard
What I am trying to do is crop an image into pieces that are not always the same size and make an animation. When the cropped image is smaller than the crop dimensions, I was trying to have the frame background be some other color rather than black when using -dispose background. Is there some simple command that controls the background color for filling the frame when creating an animation? I tried adding -fill and -bacgkround but the background is still black.
Input:
convert lena.jpg -crop 120x120 miff:- | convert -fill white -background white -dispose background -delay 50 - -loop 0 lena_ani.gif
Result:
[Resolved]dispose background for animation
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
[Resolved]dispose background for animation
Last edited by fmw42 on 2012-06-06T20:24:44-07:00, edited 1 time in total.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: dispose background for animation
Originally I believe GIF disposal 'background' meant to dispose of the last frame area to the background color which is stored in the GIF image.
However The web browsers never did this (starting with the first real browser 'mosaic'), but instead always disposed to 'transparency', or the page background coloror texture. As this gave GIF animations a practical and popular application, no animation program I know of actually maked proper use the 'background color' attribute of the GIF image file format, as it was intended.
In essence dispose background may as well now mean dispose to transparency, rather that dispose to background.
The background attribute is now generally ignored, though can effect some image processing options in IM (as IM will use it if the 'background' color setting has not been set when a GIF image is read in, and used).
For example
will show the background color form the GIF image.
For example, I did not set my GIF background color properly when I saved my 'IM examples splash logo', so it can some out horible...
This is different to using the actual 'transparency color' used to define palette boolean transparency in the GIF, which you get if you just turn transparency off!
Note that using 'dispose previous' also means the same thing if ALL the previous frames are also all dispose previous. The only time dispose previous actually means 'previous' (rather than transparency), is if you have a previous frame that has some other form of disposal. And that dispose undefined (which is a valid disposal setting), is generally thought of as the same as dispose 'none'
Disposals are all exampled in IM Examples, Animation Basics.
http://www.imagemagick.org/Usage/anim_basics/#dispose
How animations use disposals will determine the 'style' or 'type' of animation generated.
http://www.imagemagick.org/Usage/anim_basics/#types
Mixed disposals (other than perhaps the first frame) is rare.
However The web browsers never did this (starting with the first real browser 'mosaic'), but instead always disposed to 'transparency', or the page background coloror texture. As this gave GIF animations a practical and popular application, no animation program I know of actually maked proper use the 'background color' attribute of the GIF image file format, as it was intended.
In essence dispose background may as well now mean dispose to transparency, rather that dispose to background.
The background attribute is now generally ignored, though can effect some image processing options in IM (as IM will use it if the 'background' color setting has not been set when a GIF image is read in, and used).
For example
Code: Select all
convert image.gif -alpha remove show:
For example, I did not set my GIF background color properly when I saved my 'IM examples splash logo', so it can some out horible...
Code: Select all
convert http://www.imagemagick.org/Usage/images/splash.gif -alpha remove splash_alpha_remove.gif
This is different to using the actual 'transparency color' used to define palette boolean transparency in the GIF, which you get if you just turn transparency off!
Code: Select all
convert http://www.imagemagick.org/Usage/images/splash.gif -alpha off splash_alpha_off.gif
Note that using 'dispose previous' also means the same thing if ALL the previous frames are also all dispose previous. The only time dispose previous actually means 'previous' (rather than transparency), is if you have a previous frame that has some other form of disposal. And that dispose undefined (which is a valid disposal setting), is generally thought of as the same as dispose 'none'
Disposals are all exampled in IM Examples, Animation Basics.
http://www.imagemagick.org/Usage/anim_basics/#dispose
How animations use disposals will determine the 'style' or 'type' of animation generated.
http://www.imagemagick.org/Usage/anim_basics/#types
Mixed disposals (other than perhaps the first frame) is rare.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: dispose background for animation
So are you saying there is no way to put some other color there for the background?
Also if you look carefully at my animation, you see that when one frame is disposed (frames 5 and 6 starting from 1) there is a remnant slightly redish-black left behind rather than pure black. I do not get that!
P.S. See my bugs post at viewtopic.php?f=3&t=21171, which is then most likely not a bug, but a limitation of the browsers showing a proper background.
Also if you look carefully at my animation, you see that when one frame is disposed (frames 5 and 6 starting from 1) there is a remnant slightly redish-black left behind rather than pure black. I do not get that!
P.S. See my bugs post at viewtopic.php?f=3&t=21171, which is then most likely not a bug, but a limitation of the browsers showing a proper background.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: dispose background for animation
Seems to be an issue with Safari. The above animation on Safari has nearly black background. On Firefox, it is transparent.
But thanks for the information about the disposal method. At least that is consistent with what I saw using Firefox and your disposal background discussion on your Examples page.
But thanks for the information about the disposal method. At least that is consistent with what I saw using Firefox and your disposal background discussion on your Examples page.