Page 1 of 1

Problem with Shadow. It doesn't show

Posted: 2017-04-08T04:40:01-07:00
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

Re: Problem with Shadow. It doesn't show

Posted: 2017-04-08T05:27:21-07:00
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.

Re: Problem with Shadow. It doesn't show

Posted: 2017-04-08T09:29:19-07:00
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?

Re: Problem with Shadow. It doesn't show

Posted: 2017-04-08T10:27:08-07:00
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?

Re: Problem with Shadow. It doesn't show

Posted: 2017-04-08T10:59:15-07:00
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.

Re: Problem with Shadow. It doesn't show

Posted: 2017-04-08T20:08:27-07:00
by Airon65
Thanks for the explanation! Now I've got it. I believed that there is a easier way for achieving it :)