Trying to add shadowed text to an existing image

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
clownpleco
Posts: 6
Joined: 2012-09-24T10:23:12-07:00
Authentication code: 67789

Trying to add shadowed text to an existing image

Post by clownpleco »

I pulled this exact command out of the ImageMagick doc and having no luck:

convert -background none -stroke black -fill white \
-font Candice -pointsize 48 label:'Sept ' \
\( +clone -background navy -shadow 80x3+3+3 \) \
-background none -compose DstOver -flatten base-t0.png

convert: not authorized `Sept ' @ error/constitute.c/ReadImage/454.
convert: image sequence is required `+clone' @ error/convert.c/ConvertImageCommand/935

centos 7
Version: ImageMagick 6.7.8-9 2019-02-01 Q16 http://www.imagemagick.org
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Trying to add shadowed text to an existing image

Post by fmw42 »

Do you have the Candice font installed and in your type.xml file? If not, install it and replace Candice with the path to your candice.ttf file. Does that make it work? That worked for me on ImageMagick 6.7.8.9 Q16 Mac OSX. If that does not work, then your Centos version of ImageMagick is buggy. Note that Linux distributions do not always patch completely. Often they only patch for security. So your version might not be good. Does

Code: Select all

convert -version
work OK?

What about

Code: Select all

convert logo: logo.png
What about

Code: Select all

convert -background red -stroke black -fill white -font Arial -pointsize 48 label:"Sept" test.gif
clownpleco
Posts: 6
Joined: 2012-09-24T10:23:12-07:00
Authentication code: 67789

Re: Trying to add shadowed text to an existing image

Post by clownpleco »

convert -version
Version: ImageMagick 6.7.8-9 2019-02-01 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2012 ImageMagick Studio LLC
Features: OpenMP

convert logo: logo.png
Worked fine.

Last command failed.

Note - I removed -font completely as to use the default font.

Not sure if this helps, but this works
convert base-t0.png -gravity south -pointsize 40 \
-stroke '#000C' -strokewidth 2 -annotate 0 'September - November' \
-stroke none -fill white -annotate 0 'September - November' \
test.png

I just need the shadow added.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Trying to add shadowed text to an existing image

Post by fmw42 »

Try specifying -font path_to/fontfile.ttf. Be sure whatever font file you use does exist. Sounds like your type.xml file is empty, so that named fonts do not work. But font files should work if the font exists.
clownpleco
Posts: 6
Joined: 2012-09-24T10:23:12-07:00
Authentication code: 67789

Re: Trying to add shadowed text to an existing image

Post by clownpleco »

I'm not worried about the font issue (that appears to be an easy fix). Problem is I could not get the command to work at all. See error message at the top of the thread.
After a google search, I did find that updating policy.xml for label helped. I'm now able to make an image with just the annotation. I'll probably just combine the new image with the previous base image. I was just hoping I could have done it with one command.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Trying to add shadowed text to an existing image

Post by fmw42 »

Sorry, I do not know what might be the issue other than a buggy version of ImageMagick. It worked fine for me on my Mac using the same ImageMagick version. Try changing single quotes to double quotes. Also try changing -annotate 0 to -annotate +0+0
Post Reply