Free Support Forum - aspose.com

Image sizing

I have a slight issue when generating and inserting an image within the WORD document.

Bitmap objBmp = new Bitmap(325, 200, PixelFormat.Format24bppRgb);
Graphics objGraphics = Graphics.FromImage(objBmp);
objBmp.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);
image = System.Drawing.Image.FromStream(ms);
builder.InsertImage(image);

Problem is that when the WORD document renders, the image is larger that expected.
I then right-click on the image and select “Reset Picture” on the Picture Tool Bar within
WORD which then causes the image to display within the correct, original dimensions…

Any ideas as to why this happens ?

Thx

Hi,

It has to do with one poorly documented feature that we don’t understand in .doc format.

Normally, information is stored in twips (1/20 of a point), but it seems when it comes to images the information is sometimes is stored in 1/15th of a point and we are not sure when and why.

I’ll look into this issue once again, but I’m afraid if I change it the other way around - somebody else will complain. That’s what’s happened before why it’s now doing bigger images for you.

We expect to receive latest .doc file format documentation soon, maybe this will clarify the things for us.

Now you know the reason, how critical is for you to have a fix quickly?

Just thought I'd mention I'm running into this issue as well. My images are scaling up to 125% of the size specified (which seems to fit the difference between 1/15 and 1/20).

Hopefully a fix will be forthcoming, but is there a hack that will work in the meantime? I've tried playing with different image resolutions but they don't seem to make a difference.

What would probably work for me, assuming it's possible, would be a way to specify in the DocumentBuilder.InsertImage() function which ratio to use, 1/15 or 1/20. My images are always going into a new section at the end of a document and are always scaling up.


Thanks for your report. I will address this scaling issue in one-two days.

This is fixed in Aspose.Word 1.6.11, please check out http://www.aspose.com/forums/ShowPost.aspx?PostID=8134

I have to come back to this issue,
I’m working with 1.7.4 and I have still the problems mentioned above.

I use EMF-Files, maybe this is the source.

Please feel free to ask for document and image file.

Regards,
Mirjam