AddPicture oversizes the image

When I add an image to a worksheet using XlsIO (worksheet.Pictures.AddPicture(1,1,"map.png", ExcelImageFormat.Png) the image size is not preserved.

The png image that I have is 1862x4575 pixels at 300dpi. This should be 6.21x15.25 inches. Inserting with Excel does it correctly.

I've attached a spreadsheet with the image as manually inserted via Excel on one tab (correctly sized) and another tab showing the results of XlsIo inserting the image (waaaaaay oversized).

What is the reason for this? What is the workaround?

Thanks much,

Dave R





map_8b3ede2a.zip

2 Replies

DR Dave R June 23, 2010 11:24 PM UTC

Also, I tried using the 'scale' parameters which do allow me to reduce the size of the image:

Sheet.Pictures.AddPicture(1, 1, mapImage, 33, 33, ExcelImageFormat.Png);

Unfortunately, this also reduces the quality of the image.

Because the image that I am showing is generated by another process, I don't know in advance the size or shape of the image. All I know is that it will (or should) fit on 11x17 paper with room for a limited amount of text. I just need to be able to place the image at r1 c1 and have it display to its correct size.

Attached is the actual image...



MapPng_c2b0cb56.zip


SB Sathish Babu R Syncfusion Team June 24, 2010 01:32 PM UTC

Hi Dave,

Thank you for your interest in Syncfusion products.

We were able to reproduce the issue at our side and the issue mentioned here is suspected to be defect. Could you please report this issue through Direct Trac Developer Support System?
https://www.syncfusion.com/account/login?ReturnUrl=%2fsupport%2fdirecttrac%2fincidents so that we can provide you with the patch for this issue as well as you can take the advantage of the expertise of a dedicated support engineer and a guaranteed response time and we hope you will take advantage of this system as well.

Please let me know if you have any queries.

Regards,
Sathish

Loader.
Up arrow icon