Problem with Shadow. It doesn't show

Magick++ is an object-oriented C++ interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning Magick++.
Post Reply
Airon65
Posts: 75
Joined: 2017-02-26T02:19:38-07:00
Authentication code: 1151

Problem with Shadow. It doesn't show

Post by Airon65 »

My piece of code:

Code: Select all

Magick::Image img5( Magick::Geometry( 600, 600 ), Magick::Color( QuantumRange, QuantumRange, QuantumRange, 0 ) );
img5.font( "Verdana" );
img5.fontPointsize( 50 );
img5.fillColor( Magick::Color( "maroon" ) );
img5.strokeColor( Magick::Color( "red" ) );
img5.strokeWidth( 2 );
img5.textGravity( MagickCore::CenterGravity );
img5.draw( Magick::DrawableText( 0, 0,  "Some text" ) );
img5.trim();

img5.shadow();

img5.write( "images/test.png" );
I see the white label only. How to apply shadow properly?

ImageMagick 7.0.5-2 Q16 x86_64 2017-03-11
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Problem with Shadow. It doesn't show

Post by snibgo »

Airon wrote:I see the white label only.
The shadow is the current background colour. You haven't set this, so you get the default, which is white. You get what you asked for: a white shadow.

If you want to put a shadow behind the original image, you need another step, which is show (in command-line form) at http://www.imagemagick.org/Usage/blur/#shadow.
snibgo's IM pages: im.snibgo.com
Airon65
Posts: 75
Joined: 2017-02-26T02:19:38-07:00
Authentication code: 1151

Re: Problem with Shadow. It doesn't show

Post by Airon65 »

snibgo wrote: 2017-04-08T05:27:21-07:00
Airon wrote:I see the white label only.
The shadow is the current background colour. You haven't set this, so you get the default, which is white. You get what you asked for: a white shadow.

If you want to put a shadow behind the original image, you need another step, which is show (in command-line form) at http://www.imagemagick.org/Usage/blur/#shadow.
I think I should do these steps:

Code: Select all

convert -background none -stroke black -fill white \
          -font Candice -pointsize 48 label:'A ' \
          \( +clone -background navy -shadow 80x3+3+3 \) \
          -background none -compose DstOver -flatten  shadow_a_size.png
but I don't know what does mean two last lines. Can you help me with that?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Problem with Shadow. It doesn't show

Post by snibgo »

Sorry, I don't use C++ or Magick++. But the documentation is quite good.

Why are you writing this as a program? Why not use the command-line?
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Problem with Shadow. It doesn't show

Post by fmw42 »

The third line means make a clone of the image and convert it to a shadow. The last line means compose the original image over the shadow image.
Airon65
Posts: 75
Joined: 2017-02-26T02:19:38-07:00
Authentication code: 1151

Re: Problem with Shadow. It doesn't show

Post by Airon65 »

Thanks for the explanation! Now I've got it. I believed that there is a easier way for achieving it :)
Post Reply