Cant get Image Drop Shadow to Work
Posted: 2017-03-21T15:45:53-07:00
I am having a really hard time trying to get drop shadows for an image to work; i thought it would be quite easy but no matter what i do nothing works.
This is the code i am trying to use with the following image
I even tried an example posted in these forums and that didnt work either, all I get is the following look:
When what i want is:
Can anyone help please; i have spent all day on this and am not really any further forward.
This is the code i am trying to use with the following image
Code: Select all
using( MagickImage image = new MagickImage( "d:\\mainimage.jpg" ) )
using( var savedShadowImageStream = new FileStream( "d:\\shadow-imagemagik.jpg", FileMode.Create ) )
{
image.Strip();
image.Quality = 100;
image.Resize( 2000, 0 );
MagickImage shadow = image.Clone();
shadow.Quality = 100;
// shadow( x, y, sigma, alpha, colour )
// basically i dont get any sort of blurred shadow
// x and y dont seem to do anything at all
// sigma seems to be shadow size and not the amount of blur
// alpha doesnt seem to do anything either
shadow.Shadow( 10, 10, 0.5, new Percentage( 80 ), MagickColor.FromRgb( 127, 127, 127 ) ); // this makes the shadow size tiny
// shadow.Shadow( 10, 10, 20, new Percentage( 80 ), MagickColor.FromRgb( 127, 127, 127 ) ); // this makes the shadow size bigger, but why its supposed to be the blur size
shadow.Composite( image, CompositeOperator.Replace );
shadow.Write( savedShadowImageStream, MagickFormat.Jpeg );
}
When what i want is:
Can anyone help please; i have spent all day on this and am not really any further forward.