Page 1 of 1
Question about caption:
Posted: 2016-04-13T16:41:47-07:00
by Don
Hello there,
I was searching around and it seems that gradient fill only works for -annotate and not for caption:?
I was wondering if it's possible to apply a gradient fill to text created with caption:
Thank you.
Re: Question about caption:
Posted: 2016-04-13T17:26:17-07:00
by fmw42
Gradient fill is not a direct option for caption:. But you can do it with more in the command line by creating a gradient after the fact and then composing the text over the gradient. Try (unix syntax)
Code: Select all
convert -size 256x -pointsize 64 -background none \
-fill red -font Arial -gravity center caption:"Testing" \
\( -clone 0 -alpha opaque -sparse-color Barycentric '0,0 black %[fx:w-1],0 white' \) \
+swap -compose over -composite caption_gradient_background.png
or
Code: Select all
convert -size 256x -pointsize 64 -background none -fill red -font Arial -gravity center caption:"Testing" \
\( -clone 0 -alpha opaque -sparse-color Barycentric '0,0 black %[fx:w-1],0 white' \) \
-compose dstover -composite caption_gradient_background.png
See
http://www.imagemagick.org/Usage/canvas ... _gradients
Please always provide your IM version and platform, since syntax may differ
Re: Question about caption:
Posted: 2016-04-13T23:02:55-07:00
by Don
Hello, thanks for response.
I apologize for not being more precise, I meant is it possible to apply a gradient to text using caption?
For example, the word testing to go from black to white like how it is in the second example in the following link:
http://www.imagemagick.org/Usage/fonts/
From what I gathered, it seems to only work with annotate.
Thanks again.
P.S. IM version: ImageMagick 6.9.1-0 Platform: Linux
Re: Question about caption:
Posted: 2016-04-14T09:43:01-07:00
by fmw42
Not directly. But this works for me (by creating a mask of the text and compositing it to control the mix of the gradient and the background)
Code: Select all
convert -size 256x -pointsize 64 -background black \
-fill white -font Arial -gravity center caption:"Testing" \
\( -clone 0 -alpha opaque -sparse-color Barycentric '0,0 black %[fx:w-1],0 white' \) \
\( -clone 0 -alpha opaque -fill red -colorize 100 \) \
-reverse -compose over -composite caption_gradient.png
Re: Question about caption:
Posted: 2016-04-14T23:52:59-07:00
by Don
Hmm that looks about right... would it be possible though to have the gradient go vertically and if the background can be transparent?
Thank you.
Re: Question about caption:
Posted: 2016-04-15T09:02:51-07:00
by fmw42
Code: Select all
convert -size 256x -pointsize 64 -background black \
-fill white -font Arial -gravity center caption:"Testing" \
\( -clone 0 -alpha opaque -sparse-color Barycentric '0,0 black 0,%[fx:h-1], white' \) \
\( -clone 0 -alpha transparent \) \
-reverse -compose over -composite caption_gradient2.png
Re: Question about caption:
Posted: 2016-04-16T22:43:49-07:00
by Don
Hello, that is great! Thanks!
I tried to add a stroke to it but doing the following but no results.. is it possible to add stroke?
Code: Select all
convert -size 256x -pointsize 64 -background black -fill white -font Arial -stroke yellow -strokewidth 2 -gravity center caption:"Testing" \( -clone 0 -alpha opaque -sparse-color Barycentric '0,0 black 0,%[fx:h-1], white' \) \( -clone 0 -alpha transparent \) -reverse -compose over -composite caption_gradient2.png
As always, thank you again!
Re: Question about caption:
Posted: 2016-04-17T11:18:17-07:00
by fmw42
It is possible, but not directly. It gets even more complicated. But you might take a look at my texteffect script at the link below. For example:
Code: Select all
texteffect -t "SOME GRADIENT TEXT" -s outline -e normal -f Arial -p 48 \
-c red-blue -b none -o yellow -l 3 -u none -A 0 gradient_outline_text.png
The script does not wrap text however. So it is more like label: than caption: