Greetings Gurus,
I have a command line which works fine except for the hardcoded image size. It overlays a gradient onto an image.
How can the command dynamically generate the Gradient Size automatically based on the current image being processed ("%x") ?
This is the windows command line.
composite.exe -compose Dst_In "%x" ( -size 24x24 gradient:black-white -alpha Set ) png32:"%x"
Generate Gradient size based on existing image
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Generate Gradient size based on existing image
You need to use -sparse-color barycentric. See http://www.imagemagick.org/Usage/canvas ... _gradients
In unix syntax, it would be
In windows, I believe it would be
The code in parenthesis will create the gradient.
The following ... means put whatever code you want. If you want to do compositing, you probably need to use the convert -compose composemethod -composite style syntax. See http://www.imagemagick.org/Usage/compose/
In unix syntax, it would be
Code: Select all
convert image \
\( -clone 0 -sparse-color Barycentric '0,0 white 0,%[fx:h-1] black' \) \
...
In windows, I believe it would be
Code: Select all
convert image ^
( -clone 0 -sparse-color Barycentric '0,0 white 0,%[fx:h-1] black' ) ^
...
The following ... means put whatever code you want. If you want to do compositing, you probably need to use the convert -compose composemethod -composite style syntax. See http://www.imagemagick.org/Usage/compose/
Re: Generate Gradient size based on existing image
Thanks Fred, that's it!