Copyright © Fred Weinhaus My scripts are available free of charge for non-commercial (non-profit) use, ONLY. For use of my scripts in commercial (for-profit) environments or non-free applications, please contact me (Fred Weinhaus) for licensing arrangements. My email address is fmw at alink dot net. If you: 1) redistribute, 2) incorporate any of these scripts into other free applications or 3) reprogram them in another scripting language, then you must contact me for permission, especially if the result might be used in a commercial or for-profit environment. Usage, whether stated or not in the script, is restricted to the above licensing arrangements. It is also subject, in a subordinate manner, to the ImageMagick license, which can be found at: http://www.imagemagick.org/script/license.php Please read the Pointers For Use on my home page to properly install and customize my scripts. |
Creates a ramped alpha channel from the input image according the specified color. |
last modified: December 15, 2018
USAGE: color2alpha [-ca alphacolor] [-cr replacecolor] [-a] [-g gain]
infile outfile
-ca ... alphacolor ..... color to to become transparent in the alpha channel; PURPOSE: To create a ramped alpha channel from the input according the specified color. DESCRIPTION: COLOR2ALPHA creates a ramped alpha channel from the input image according to the specified color. The output can be either the alpha mask alone or made as an alpha channel on the input image. If a second replacement color is provided, then the output will use the alpha channel to replace the specified colors and those near it with the replacement color. This is useful to change one color to another with anti-aliasing, especially when converting background color under colorized text or vice-versa. ARGUMENTS: -ca alphacolor ... ALPHACOLOR is the color that is to become transparent in the alpha channel. Any valid opaque IM color is allowed. The default=red. -cr replacecolor ... REPLACECOLOR is the color to use to replace the alphacolor in the output. Any valid IM color is allowed. The default does no color replacement in the output and the alpha channel is attached to the input. -a ... output only the ALPHA channel. -g gain ... GAIN control for the transition between black and white in the alpha channel. Values are floats>0. The default=1. Values larger than 1 will show more transparency and a shorter transition. Value smaller than 1 will show less transparency and a longer transition. REFERENCE: http://www.gimp.org/tutorials/Changing_Background_Color_1/ REQUIREMENTS: IM 6.6.0.4 in order to support -evaluate-sequence max CAVEAT: No guarantee that this script will work on all platforms, nor that trapping of inconsistent parameters is complete and foolproof. Use At Your Own Risk. |
EXAMPLE 1 --- Rainbow Image; Alpha Only |
||
Original |
||
![]() |
||
Arguments: |
||
![]() |
||
Arguments: |
||
![]() |
||
Arguments: |
||
![]() |
EXAMPLE 2 --- Rainbow Image; Alpha Channel On Input |
||
Original |
||
![]() |
||
Arguments: |
||
![]() |
||
Arguments: |
||
![]() |
||
Arguments: |
||
![]() |
EXAMPLE 3 --- Rainbow Image; Red Replaced With Cyan |
||
Original |
||
![]() |
||
Arguments: |
||
![]() |
||
Arguments: |
||
![]() |
||
Arguments: |
||
![]() |
EXAMPLE 4 --- Text Background Blue Color Replace With Red |
||
Original |
||
![]() |
||
Original 6x Z00M |
||
![]() |
||
Arguments: |
||
![]() |
||
Arguments: |
||
![]() |
||
Arguments: |
||
![]() |
What the script does is as follows:
This is equivalent to the following IM commands
|