Shadow of caption AND image blured

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
TerraD
Posts: 2
Joined: 2018-03-05T08:58:14-07:00
Authentication code: 1152

Shadow of caption AND image blured

Post by TerraD » 2018-03-05T09:15:59-07:00

Hi

I'm all new to ImageMagick and due to my mothertongue some details are pretty hard to understand. Unluckily most samples have a monchrome background, while I need a .jpg

After some trial an error I almost got what I want:

Code: Select all

convert myImage.jpg -font Calibri -pointsize 48 -gravity south -stroke black -strokewidth 2 -annotate +5+5 "myImage" -blur 0x4 -stroke black -strokewidth 1 -fill white -annotate +0+10 "myImage" myImage.png
Most of this was taken from the 'Fuzzy Shadow' sample. However in the sample is just a lightblue background... no matter if that blurs!

But: I don't want the original picture myImage.jpg to be blured, only the caption should have a shadow to be better readable.

I failed trying to make this work with -shadow...

User avatar
fmw42
Posts: 23245
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Shadow of caption AND image blured

Post by fmw42 » 2018-03-05T11:19:49-07:00

You need to create a new text image, blur it, then overlay it on your image. For example (unix syntax):


Image

Code: Select all

convert lena.jpg \
\( -size 200x -background none -font ubuntu -fill black label:TESTING -blur 0x3 \) \
-gravity center -compose over -composite \
result.jpg
Image

See
https://www.imagemagick.org/Usage/text/

If on Windows do not escape the parentheses and change the end of line \ to ^

If you want multi-line text, then use caption: rather than label:. Or create a text only image on transparent background writing the text with -annotate or -draw. Then composite it over your background image.

TerraD
Posts: 2
Joined: 2018-03-05T08:58:14-07:00
Authentication code: 1152

Re: Shadow of caption AND image blured

Post by TerraD » 2018-03-06T02:41:51-07:00

Thank you for this input. I'm not yet where I want to be, but you gave me input in which direction to continue...

I skipped through your ImageMagick Scripts and was impressed by the possibilities! GREAT work, thank you for this inspiration!

Post Reply