Group: Forum Members
Last Active: 3 Years Ago
Posts: 8,
Visits: 18
|
Hello,
I am using the following code to download the renderings as image from NThinDiagramControl. I need to set the Transparency for the image. Please let me know how can i set it.
Dim image As INImage = NThinDiagramControl1.GetImage(imageFormat, New NSize(txtImgPixelSize.Text.Trim, txtImgPixelSize.Text.Trim), New NResolution(200, 200))
Thanks
|
Group: Forum Members
Last Active: Last Month
Posts: 3,055,
Visits: 4,052
|
Hello Kirk , Generating transparent PNG images is not supported out of the box , but you can try the following workaround : 1 . Create a PNG image format with a pixel format that supports transparency 2 . Generate a raster image 3 . Use the MakeTransparent method of the . NET bitmap object to make the white pixels transparent 4 . Save the bitmap to file or stream Following is a code example : NPngImageFormat pngFormat = new NPngImageFormat(); pngFormat.PixelFormat = System.Drawing.Imaging.PixelFormat.Format32bppArgb;
NRasterImage image = NThinDiagramControl1.GetImage(pngFormat) as NRasterImage; image.Bitmap.MakeTransparent(Color.White); image.Bitmap.Save(@"C:\web-image.png");
NPngImageFormat pngFormat = new NPngImageFormat();
pngFormat.PixelFormat = System.Drawing.Imaging.PixelFormat.Format32bppArgb;
NRasterImage image = NThinDiagramControl1.GetImage(pngFormat) as NRasterImage;
image.Bitmap.MakeTransparent(Color.White);
image.Bitmap.Save(@"C:\web-image.png");
Best Regards, Nevron Support Team
|