I've read about the opague feature and wondered is there's a simple way to fade an entire image by some percentage instead of attempting to fade each color separately?
thanks in advance...
Jeff
setting transparency - fading an image
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: setting transparency - fading an image
Do you mean a global fade so all pixels have the same transparency or do you mean a gradient fade so that it is more transparent on one side than the other?
If the former, then this will set the opacity to 25% (75% transparent)
convert <image> -alpha on -channel a -evaluate set 25% result.png
If the former, then this will set the opacity to 25% (75% transparent)
convert <image> -alpha on -channel a -evaluate set 25% result.png
Re: setting transparency - fading an image
yes, global fade - so thank you very much!
Jeff
Jeff
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: setting transparency - fading an image
Also do you mean fade to a color (like white or black) Also known as de-contrasting.
Or do you mean to transparency?
To a color you can use -colorize. for example
That will fade the image to black by overlaying a 50% transparent black.
It also will not 'fade' any fully-transparent areas in the image toward black.
See IM examples, Colorize
A more controls greyscale fading can be achieved using Reversed Level Adjustments
Or do you mean to transparency?
To a color you can use -colorize. for example
Code: Select all
convert input -fill black -colorize 50% output
It also will not 'fade' any fully-transparent areas in the image toward black.
See IM examples, Colorize
A more controls greyscale fading can be achieved using Reversed Level Adjustments
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: setting transparency - fading an image
[root@localhost seo-images]# convert dim.jpg -alpha on -channel a -evaluate set 50% results.jpg
convert: unrecognized option `-alpha'.
??? - what now?
convert: unrecognized option `-alpha'.
??? - what now?
Re: setting transparency - fading an image
I found that this worked fine though:
convert dim.jpg -fill white -colorize 50% results.jpg
convert dim.jpg -fill white -colorize 50% results.jpg
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: setting transparency - fading an image
That is not transparency fading, but fading to 'white'.jjj0923 wrote:I found that this worked fine though:
convert dim.jpg -fill white -colorize 50% results.jpg
For a image destined for viewing on a white background such as in a browser, that will work fine, and even work better for older Internet Explorers that did not handle PNG transparency right. Or for JPEG images which does not handle transparency at all!.
-alpha replaces +/-matte functionality, providing many.
-matte is equivelent to -alpha set which is what you should be using.
So try this...
Code: Select all
convert dim.jpg -matte -channel a -evaluate set 50% results.jpg
ASIDE: For new images -alpha set and -alpha on are equivelent. But for old images possibility containing old alpha channels -alpha on can cause problems you should use -alpha set, which will ensure alpha is present, but does not change the current look of the image if an old alpha channel was present.
For more details see IM Examples, Basics, Controlling Image Transparency
http://www.imagemagick.org/Usage/basics/#alpha
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: setting transparency - fading an image
jjj0923 wrote:[root@localhost seo-images]# convert dim.jpg -alpha on -channel a -evaluate set 50% results.jpg
convert: unrecognized option `-alpha'.
??? - what now?
Your IM version is too old. What version are you using? In old versions use -matte, in newer versions the more correct equivalent is -alpha set