myspacee wrote: ↑2017-06-16T13:18:15-07:00i want to learn how apply gradient mask on image. [...] I'm using windows version, so help me with syntax please.
Using IM 6.9.7-6 HDRI on Windows 10, and running this in a CMD window, I get the result you described.
Code: Select all
convert input.jpg -alpha set -background none -channel A ^
( +clone -sparse-color barycentric "0,0 white %[w],0 none" ) -compose copyopacity -composite output.png
That reads the input image, sets the alpha channel to active, sets a background color of "none", and sets the active channel to "A" so it runs the following operations on the alpha channel.
Then it clones the input image and colors that clone with a gradient going from white on the left to transparent on the right. That makes a mask the same dimensions as your input image.
Then it sets a compose method of "copyopacity" and composites the mask over the input image. It essentially displays your input from 100% where the mask is white down to 0% where the mask is transparent.
This method makes it easy to modify the start and end points for the gradient. You could make the fade start one third in from the left side and run just another third across the width with something like this...
Code: Select all
... ( +clone -sparse-color barycentric "%[fx:w*0.33],0 white %[fx:w*0.66],0 none" ) ...
Or make the gradient run corner to diagonal corner like this...
Code: Select all
... ( +clone -sparse-color barycentric "0,0 white %[w],%[h] none" ) ...
The same command should work in IM7 by using "magick" instead of "convert".
To run this from a BAT script you'd need to change the single percent signs "%" to doubles "%%".