ImageData.ImageSize.WidthPoints too high

Hi,

I’ve just upgraded (installed the MSI) to 6.5.0 and have started testing my app. I have encountered a problem scaling EMF images.

ImageData.ImageSize.WidthPixels and .HeightPixels are almost identical to the h and w of the original image. The value of WidthPoints and HeightPoints are not as they were in 6.4.0 and are too large.

As a workaround, I have divided the .WidthPixels by 72 as the equivalent of .WidthPoints and the scaling appears to work as before. (note the correct workaround might be using the value of horizontalresolution).

Has anyone else seen this? Does this problem make sense given the changes made for 6.5.0?

Regards, Bruce

Hi Bruce,

Thanks for your request. Could you please attach your document here for testing? I will check the issue and provide you more information.

Best regards.

Hi Alexey,

I have taken your advise and have created a sample project. The sample project appears to not have the problem. My big problem is that I have not found a way to get the exact EMF Image used in the application to use in the test sample. The image I am able to use has been converted at least 3 times before before being used in the sample project.

One area that is very different is the H and W of the image. The image at the point I add it to a shape object has the following size: H: 63024 and W: 108956. (I now believe these are in mm). The same picture used in the sample has H: 4501 and W: 6011. This image has been scaled by the shape object and through various copy / paste operations to get into a readable file.

As I indicated, I have a workaround (just calculating an alternative WidthPoints) so I will make this a bit lower priority unless you do have an idea of how to capture the EMF file.

I am also wondering what has changed in 6.5.0 as 6.4.0 worked fine.

Thanks for your help!!

Regards, Bruce

Hi Bruce,

It is difficult to say what causes the problem without your document and code. Maybe, there were some changes in the code, which calculates size of EMF images.

To isolate the problem you can try saving EMF image in your real application just before inserting it into the document.

Best regards.

Hi Alexey,

I wish it was that easy… EMFs are saved from .NET as PNGs. So I am actually using Aspose.Words as a way to export EMF files in PDF files or Word documents where the quality of the EMF is retained. MS just did not implement the EMF converter in .NET. If you know another way, please let me know!

I can assure you that I did not change any code at the time I upgraded to 6.5.0.

I’m happy to send you the sample I made to show how I create the shape and add the shape to the document… It’s pretty ordinary code out of the help file and scales the image to the width of the paper thus the importance of getting reliable image width information.

Thanks again for your help!!

Regards, Bruce

Hi

Thank you for additional information. Just do not use Image object to save your EMF image. I suppose you have it as a stream or as array of bytes on your side. So you can just save it directly to file without creating Image object.

Also, you can just attach your document here, I will check it and provide you more information.

Best regards.