We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Shape.ToImage render incorrect image

Hi,
I need to save shapes as image

Diagram diagram = new Diagram(“d:/sample.vsdx”);
int i = 0;
ImageSaveOptions options = new ImageSaveOptions(SaveFileFormat.PNG);

foreach (Shape shape in diagram.Pages[0].Shapes)
{
if (shape.Type.ToString() != “Shape” ||
(shape.Type.ToString() == “Shape” && shape.NameU.Length > 0 && !shape.NameU.Contains(“Dynamic connector”)))
{
shape.ToImage($“d:/var/shape{++i}.png”, options);
}
}
diagram.Save($“d:/var/diagram.png”, options);

But ToImage save incorrect images.
How can I get correct shape image with transparent background color?
I attached file with Diagram.Save result and Shape.ToImage results
shapes.zip (41.3 KB)

@dmbk,

Kindly send us your source VSDX drawing. We will investigate your scenario in our environment and share our findings with you.

sample.zip (135.1 KB)

@dmbk,

We managed to replicate the problem of incorrect rendering of shapes. It has been logged under the ticket ID DIAGRAMNET-51452 in our bug tracking system. We have linked your post to this ticket and will keep you informed regarding any available updates.

In reference to the transparency of shapes, you can set transparency from 0 to 1 (complete transparency) scale as follows:
C#

shape.Fill.FillForegndTrans.Value = 1;
shape.Fill.FillBkgndTrans.Value = 1;

Thank you. I will wait for the fix.

@dmbk,

The linked ticket ID DIAGRAMNET-51452 has been fixed and will be included in the next version 18.5 of Aspose.Diagram for .NET API. We will notify you once the next version is published.

@dmbk,

The linked ticket ID DIAGRAMNET-51452 has been fixed. Please download and try the latest hotfix version 18.4.1 of Aspose.Diagram for .NET API.

1 Like

The issues you have found earlier (filed as DIAGRAMNET-51452) have been fixed in Aspose.Diagram for .NET 18.5. This message was posted using BugNotificationTool from Downloads module by imran.rafique