Hi, Support:
Would you please provide me a full demo to show how to crop an image with oval/circle/roundrectangle shape based on VB.net?
below is my codes, but it results in wrong position image.
Dim Img As New PngImage(CropW, CropH, PngColorType.TruecolorWithAlpha)
Dim cmxPic = New Aspose.Imaging.ColorMatrix()
Dim Opacity as single=255
cmxPic.Matrix33 = Opacity / 255.0F
Dim iaPic = New Aspose.Imaging.ImageAttributes()
iaPic.SetColorMatrix(cmxPic, Aspose.Imaging.ColorMatrixFlag.Default, Aspose.Imaging.ColorAdjustType.Bitmap)
Dim InputImg As Aspose.Imaging.Image = Aspose.Imaging.Image.Load(InputFile)
Dim g As Aspose.Imaging.Graphics = New Aspose.Imaging.Graphics(Img)
g.Clear(Aspose.Imaging.Color.Transparent)
Dim path As New Aspose.Imaging.GraphicsPath()
Dim Figure As New Aspose.Imaging.Figure()
Dim EllipseShape As EllipseShape
EllipseShape = New EllipseShape(New Aspose.Imaging.RectangleF(CropX, CropY, CropW, CropH))
Figure.AddShape(EllipseShape)
path.AddFigure(Figure)
g.Clip = New Aspose.Imaging.Region(path)
g.DrawImage(InputImg, New Aspose.Imaging.Point(0, 0))
Dim PngOps As New PngOptions()
PngOps.ColorType = PngColorType.GrayscaleWithAlpha
PngOps.ColorType = PngColorType.TruecolorWithAlpha
Do
On Error Resume Next
Img.Save(SavetoFile, PngOps)
Loop While Err.Number = 61 And Not NoTip
InputImg.Dispose()
InputImg = Nothing
Return Img
=============================================
As for the above codes, the Output image is wrong with incorrect position, and the parameter Opacity cannot be applied.
How tho fix it or is there any right method to get this purpose?
Please see the oval crop result image here:Overlay.jpg (33.3 KB)
the right oval crop output image should be a full display image, but it only partially displayed with wrong position.