Free Support Forum - aspose.com

Convert VSD to PNG using Aspose.Diagram in Java - output is incorrect

Hello Support,

We are using aspose-diagram-19.12.0-jdk16.jar [Java] to convert vsd’s each page into png but it produces incorrect output as attached.

Following is the code to reproduce the issue:-

Diagram visioDiagram1 = new Diagram(filepath);
com.aspose.diagram.ImageSaveOptions options1 = new com.aspose.diagram.ImageSaveOptions(SaveFileFormat.JPEG);
options1.setPageIndex(0);
options1.setPageCount(1);
visioDiagram1.save(imageFile.getAbsolutePath(), options1);

We have also tried with the latest aspose-diagram-20.11-jdk16.jar but the behavior remain same.

preview.png (34.0 KB)
tf16403552.zip (54.9 KB)

@neergupta

The archive you have shared seems to be damaged or corrupted. Would you please share it again so that we can test the scenario in our environment and address it accordingly. Furthermore, please also try to use latest version of the API before sharing the source file.

Hello Support,

sample_vsd.zip (55.0 KB)

Kindy refer the attached zip for vsdx file.
We actually did try with the latest version of the API but the issue still occurs.

Thanks,
Jaspreet

@neergupta

We have logged an issue as DIAGRAMJAVA-50708 in our issue tracking system for the sake of correction. We will further look into its details and keep you posted with the status of its correction. Please be patient and spare us some time.

We are sorry for the inconvenience.

@neergupta

Could you please provide the output image after highlighting the anomalies inside it? This would help us investigate the issue accordingly.

You can observe it by comparing the actual visio file vs output image. There is lot of blank space to the left, right and bottom of the image.

Can you please let me know when can we expect the fix for this?

@neergupta

We are afraid that the investigation of the ticket is not yet completed and we cannot share any ETA at the moment. However, we will soon inform you once analysis is done and some ETA news is available. Please spare us some time.

We apologize for the inconvenience.

@neergupta

We have again investigated the case and found that the generated image was as per the expectations. There may be a misunderstanding about the image height. Please check the attached screenshot where a arrow ‘2’ is referring to edge which may seem as the height of image. Whereas, it is not and the actual height of the image is at point “1” which is approx. 30px.

J50708.png (38.5 KB)

The issue is that using the above code we get lot of space on left, bottom and right when we generate images for preview of the attached vsdx file. For reference I have attached the vsdx, the image generated and a screenshot depicting the lot of space. The original vsdx file doesnot have so much space around.

Can you please guide how to convert vsdx to image with same spacing as in original vsdx file ?
VsdxToImageSpacesIssue.zip (293.8 KB)

Thanks,
Jaspreet

@neergupta

We used following code snippet with Aspose.Diagram for Java 20.12 and obtained the attached output image from it. We opened this image in MS Paint and did not notice blank space issue.

com.aspose.diagram.Diagram visioDiagram1 = new com.aspose.diagram.Diagram(dataDir + "45.1-0.1.1.vsdx");
com.aspose.diagram.ImageSaveOptions options1 = new com.aspose.diagram.ImageSaveOptions(SaveFileFormat.PNG);
options1.setPageIndex(0);
options1.setPageCount(1);
visioDiagram1.save(dataDir + "output.png", options1);

output.png (28.8 KB)

Could you please make sure to use the latest version and in case issue still persists, please share a sample console application with your environment details so that we can again try to reproduce the issue at our side and share our feedback with you accordingly.

We used the latest version 20.12. The space on left got reduced but still there is lot of space on right and bottom. Screenshots attached of original vsdx that doesnot have much space on right and bottom. But the image produced has too much of space on right and bottom.

Thanksdump.zip (234.3 KB)

@neergupta

We tested the case at our end and did not notice any issue. We used the same code snippet which was shared in our previous response and obtained the attached output image from it which is different than the one provided by you.

output.png (28.8 KB)

Could you please share a sample console application with your environment details so that we can again try to reproduce the issue at our side and share our feedback with you accordingly.

Hi support,

Thanks a lot for your feedback.

I did try the following code in my environment and output remains same with lots of space on right and bottom. We are running following code in eclipse IDE. For reference I am attaching the output and my system information.
We are using amazon corretto to execute the below program [C:\Program Files\amazon-corretto-8.252.09.2-windows-x64-jdk\jdk1.8.0_252]

public static void main(String[] args) throws Exception {
License license = new License();
InputStream licenseStream = new FileInputStream(new File(".\Aspose.Total.Java.lic"));
license.setLicense(licenseStream);

	com.aspose.diagram.Diagram visioDiagram1 = new com.aspose.diagram.Diagram("C:\\Users\\jkaur\\Downloads\\4508.vsdx");
	com.aspose.diagram.ImageSaveOptions options1 = new com.aspose.diagram.ImageSaveOptions(SaveFileFormat.PNG);
	options1.setPageIndex(0);
	options1.setPageCount(1);
	visioDiagram1.save(".\\" + "output1.png", options1);
}

Kindly let me know if you need any more details.

Thanks.
MySystemInformation.JPG (87.0 KB)
output1.png (24.7 KB)

@neergupta

Thanks for sharing further details.

We have updated the ticket information accordingly as we need to investigate it again based upon your recent comments. We will soon inform you as soon as we have some results against our investigation. Please give us some time.