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

Free Support Forum - aspose.com

Compression when importing a jpeg file into a picture

dear support,

thnak you for this product

I am having some problems reading an external jpeg file into a picture.
( I have added a picyture in the Visio and during processing, I am replacing the picture with a different picture ).

I am calling
visio.Pages(0).Shapes(...).ForeignData.Value = System.IO.File.ReadAllBytes(...)

The problem is that there seems to be a large amount of compression when the size differs.

How can I find out the size in pixels of the shape that I am adding my picture in ? If i know that, I can preprocess my jpeg file and apply suitable compression myself.

Any ideas ?

Hi Guido,

Thank you for contacting support. The XForm.Width.Value and XForm.Height.Value properties are exposed by the Shape class. These properties help to get height and width of the shape. It’s unit type is inch, 1 inch equals 72 points and 96 px at 96 dpi. If you require to get the pixel value, then please try this formula:


public static double InchToPixel(double inches, double resolution)
return resolution * inches;

We hope, this helps.