Dear all,
Please help me
I want to create a feathering feature on images like photoshop in C#.
can anyone help me on this
example is given in following link:
http://www.dummies.com/software/adobe/photoshop/how-to-soften-edges-with-feathering-in-adobe-photoshop-cs6/
Maen BadwanPosted Oct 27, 2016, 8:04 AM
This class accepts three different images: the source (front) image, the background (back) image and the mask image that contains the shape of the transparency when combing the source image with the background image.
You ca find more details about this class here:
https://www.leadtools.com/help/leadtools/v19/dh/pe/leadtools.imageprocessing.effects~leadtools.imageprocessing.effects.featheralphablendcommand.html
Also, the following code shows how you can make use of the FeatherAlphaBlendCommand class with some other image processing functions from LEADTOOLS toolkit:
//********************************
using (Leadtools.Codecs.RasterCodecs rc = new Leadtools.Codecs.RasterCodecs())
{
Leadtools.RasterImage FrontRasterImg = null;
Leadtools.RasterImage BackRasterImg = null;
Leadtools.RasterImage rasterImgAlpha = null;
FrontRasterImg = rc.Load("img1.jpg");
var command = new Leadtools.ImageProcessing.Effects.FeatherAlphaBlendCommand();
command.DestinationRectangle = new LeadRect(0, 0, rontRasterImg.Width, FrontRasterImg.Height);
rasterImgAlpha = FrontRasterImg.Clone();
Leadtools.ImageProcessing.FillCommand Filler = new Leadtools.ImageProcessing.FillCommand(RasterColor.Black);
Filler.Run(rasterImgAlpha);
BackRasterImg = rasterImgAlpha.Clone();
using (Leadtools.Drawing.RasterImageGdiPlusGraphicsContainer RasterImageGdiPlusGraphics = new Leadtools.Drawing.RasterImageGdiPlusGraphicsContainer(rasterImgAlpha))
{
RasterImageGdiPlusGraphics.Graphics.FillEllipse(Brushes.White, new Rectangle(20, 20, 200, 200));
}
Leadtools.ImageProcessing.GrayscaleCommand ToGrayscale = new Leadtools.ImageProcessing.GrayscaleCommand(8);
ToGrayscale.Run(rasterImgAlpha);
Leadtools.ImageProcessing.Effects.MotionBlurCommand MotionBlur = new Leadtools.ImageProcessing.Effects.MotionBlurCommand(20, 45 * 100, false);
MotionBlur.Run(rasterImgAlpha);
FrontRasterImg.SetAlphaImage(rasterImgAlpha);
command.MaskImage = rasterImgAlpha;
command.SourceImage = FrontRasterImg;
command.SourcePoint = new LeadPoint(0, 0);
command.MaskSourcePoint = new LeadPoint(0, 0);
command.Run(BackRasterImg);
BackRasterImg.SetAlphaImage(rasterImgAlpha);
rc.Save(BackRasterImg, "result_24.png", RasterImageFormat.Png, 24);
rc.Save(BackRasterImg, "result_32.png", RasterImageFormat.Png, 32);
}
//********************************
Disclaimer: I am an employee of this library
Abdul Amin KhanPosted Jan 21, 2017, 5:27 AM