How to apply shadow to all side of image
How to apply shadow to all side of image
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);
image2.Shadow(5,5, 10, new Percentage(10),MagickColors.WhiteSmoke);
Re: How to apply shadow to all side of image
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
Do you have any information on next release.
Re: How to apply shadow to all side of image
I published it a an hour ago
Re: How to apply shadow to all side of image
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?
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
Can you please provide sample code of Shadow. I am using AnyCPU version.
Re: How to apply shadow to all side of image
Can you share a sample image where you want to add a shadow to?
Re: How to apply shadow to all side of image
I am generating image from pdf and trying to apply shadow.
Re: How to apply shadow to all side of image
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
I am trying to generate image with drop shadow with all sides from https://sitecorepractice.files.wordpres ... m_0613.pdf first page.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: How to apply shadow to all side of image
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
Can u please provide magick.net code for the same?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: How to apply shadow to all side of image
Sorry, I do not use magick.netankit1931 wrote:Can u please provide magick.net code for the same?
Re: How to apply shadow to all side of image
Hi dlemstra, can you please provide sample code for shadow.
Re: How to apply shadow to all side of image
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.
The background color part is necessary because your PDF file appears to be CMYK and you will need to use a different color then.
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");
}
}
}
}