Page 1 of 2
How to apply shadow to all side of image
Posted: 2016-05-05T02:04:40-07:00
by durga1208
I am able to generate shadow with following code but shadow generating only right bottom. I want shadow all sides of images.
image2.Shadow(5,5, 10, new Percentage(10),MagickColors.WhiteSmoke);
Re: How to apply shadow to all side of image
Posted: 2016-05-16T06:58:01-07:00
by dlemstra
The next version of Magick.NET will include a fixed version of the Shadow method. It now automatically draws the shadow behind the image. This will prevent you from being able to draw a shadow on all sides. After the fix only the shadow will be drawn and you will have to draw your image over if with Composite yourself.
Re: How to apply shadow to all side of image
Posted: 2016-05-21T04:30:59-07:00
by durga1208
Do you have any information on next release.
Re: How to apply shadow to all side of image
Posted: 2016-05-21T04:33:44-07:00
by dlemstra
I published it a an hour ago
Re: How to apply shadow to all side of image
Posted: 2016-05-21T05:58:54-07:00
by ankit1931
How to apply shadow to all side of image?
when i am using this code "image.Shadow(5, 5, 10, new Percentage(10), MagickColors.DarkRed);"
so it is creating the shadow of the content of the image.
but i need shadow of all 4 sides of image?
Re: How to apply shadow to all side of image
Posted: 2016-05-21T06:13:19-07:00
by durga1208
Can you please provide sample code of Shadow. I am using AnyCPU version.
Re: How to apply shadow to all side of image
Posted: 2016-05-21T07:40:58-07:00
by dlemstra
Can you share a sample image where you want to add a shadow to?
Re: How to apply shadow to all side of image
Posted: 2016-05-21T11:45:09-07:00
by durga1208
I am generating image from pdf and trying to apply shadow.
Re: How to apply shadow to all side of image
Posted: 2016-05-21T12:20:28-07:00
by dlemstra
If you add a link to the PDF or image I can see what you are trying to accomplish.
Re: How to apply shadow to all side of image
Posted: 2016-05-22T09:03:21-07:00
by durga1208
I am trying to generate image with drop shadow with all sides from
https://sitecorepractice.files.wordpres ... m_0613.pdf first page.
Re: How to apply shadow to all side of image
Posted: 2016-05-22T18:58:06-07:00
by fmw42
try the equivalent of -shadow 100x5+0+0 where 100 is darkest and 5 is distance. The +0+0 means not to offset in any direction.
Code: Select all
convert inputimage \
\( +clone -background black -shadow 100x5+0+0 \) +swap \
-background none -layers merge +repage \
outputimage
Re: How to apply shadow to all side of image
Posted: 2016-05-23T02:55:44-07:00
by ankit1931
Can u please provide magick.net code for the same?
Re: How to apply shadow to all side of image
Posted: 2016-05-23T11:12:10-07:00
by fmw42
ankit1931 wrote:Can u please provide magick.net code for the same?
Sorry, I do not use magick.net
Re: How to apply shadow to all side of image
Posted: 2016-05-25T05:11:01-07:00
by durga1208
Hi dlemstra, can you please provide sample code for shadow.
Re: How to apply shadow to all side of image
Posted: 2016-05-29T02:20:52-07:00
by dlemstra
Sorry for getting back to you this late but below is a translation of Fred his commands. It is not an exact translation but it should help you.
Code: Select all
using (MagickImageCollection pdfDocument = new MagickImageCollection())
{
pdfDocument.Read("lcp-001_vectralcpprecmoldtg_am_0613.pdf");
for (int i = 0; i < pdfDocument.Count; i++)
{
var backgroundColor = MagickColors.Black;
if (pdfDocument[i].ColorSpace == ColorSpace.CMYK)
backgroundColor = new MagickColor(0, 0, 0, Quantum.Max, Quantum.Max);
using (MagickImageCollection images = new MagickImageCollection())
{
MagickImage shadow = pdfDocument[i].Clone(); // +clone
shadow.Shadow(0, 0, 5, (Percentage)90, backgroundColor); // -background black -shadow 100x5+0+0
shadow.BackgroundColor = MagickColors.None; // -background none
// +swap changes the order of the images we just add them in a different order
images.Add(shadow);
images.Add(pdfDocument[i].Clone());
using (MagickImage merged = images.Merge()) // -layers merge
{
merged.Write($"d:\pdf_{i}.png");
}
}
}
}
The background color part is necessary because your PDF file appears to be CMYK and you will need to use a different color then.