Shadowed Text over 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
riegel
Posts: 26
Joined: 2003-08-19T12:36:46-07:00
Location: Rocky Mount, NC 27804

Shadowed Text over an existing image

Post by riegel »

This may be overly simple but I can't seem to get my head around the problem. I am able to get the examples found on Anthony's excellent resource working just fine, but I am getting stuck. Here is what I am trying to do.

I would like to create some text and place it on an image. This works...

Code: Select all

convert -font TRAJANPB.TTF -pointsize 72 -fill black -annotate +28+68 'Journey' -blur 0x3 -font TRAJANPB.TTF -pointsize 72 -fill white -annotate +25+65 'Journey' logo.jpg logoshadow.jpg
It creates white text "Journey" with a black drop shadow. The problem is it blurs the image also. I just want to blur the text not the background image.

I am not sure how to get it to apply the -blur 0x3 to the text only.

Any help will be greatly appreciated.

Terry Riegel
riegel
Posts: 26
Joined: 2003-08-19T12:36:46-07:00
Location: Rocky Mount, NC 27804

Re: Shadowed Text over an existing image

Post by riegel »

As I have looked at the example I wonder if the solution is with the -clone operator. I don't really understand how this works though.
riegel
Posts: 26
Joined: 2003-08-19T12:36:46-07:00
Location: Rocky Mount, NC 27804

Re: Shadowed Text over an existing image

Post by riegel »

Ok, I am still trying to get drop shadowed text over an image. I have come up with the following...

Code: Select all

convert background.png
\(-size 780x124 xc:transparent
  -font TRAJANPB.TTF -pointsize 60 -fill black
  -annotate +28+67 'Journey'
  -blur 0x8
\)
+composite
PNG:logo.png
This seems to work except for the -blur 0x8. If I change the xc:transparent to xc:lightblue then the blur works but it doesn't overlay on the graphic since now the bg is light blue instead of transparent.

Any ideas would be appreciated.

Thanks,

Terry
riegel
Posts: 26
Joined: 2003-08-19T12:36:46-07:00
Location: Rocky Mount, NC 27804

Re: Shadowed Text over an existing image

Post by riegel »

Ok, I think I have a solution to my problem. I am posting here for any that might have the same issue.

Code: Select all

convert background.png
\( -size 780x124 xc:none
  -font TRAJANPB.TTF -pointsize 60
  -fill black
  -annotate +28+67 'Journey'
  -channel A
  -blur 0x3
  -font TRAJANPB.TTF -pointsize 60
  -fill white
  -annotate +25+65 'Journey'
\)
+composite logo.png 
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Shadowed Text over an existing image

Post by anthony »

-clone makes a new copy of the image, generally in a seperate 'image sequence' for seperate processing to the original.

Read Parenthesis first, then look at -clone further down. You will then understand what is going on.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply