Free Support Forum - aspose.com

Images of similar size displaying VERY differently

In version 4.5.0.7 I am having a problem with images of very similar size displaying extremely differently in the same spreadsheet template. Below is the code I use to display Logo images.

If show_logo = "Y" Then
If My.Computer.FileSystem.FileExists(strLogoSmPath) Then
lUseImage = True
Dim image1 As Bitmap, imgHeight As Integer
image1 = New Bitmap(strLogoSmPath)
imgHeight = image1.Height
ws0.Cells.SetRowHeight(0, imgHeight)
ws0.Pictures.Add(0, 0, strLogoSmPath, 100, 100)
End If
End If

The STW Image displays correctly as it frills up the height of the row as determined by imgHeight.

The IDM image displys at a SMALL fraction of its actual height and width.

I have attached bothe XLS fles and the images. Why is this happenning?

Thanks...

Hi,

In xls file, we find the width scale and height scale are very close to 100%.It works as the codes excepted..

We find this problem is caused by the HorizontalResolution and VerticalResolution of the two image.

Image Name Resolution Width(Pixel) Height(Pixel) Width(inch) Height(Inch).

idm_logo_small.jpg 300 175 93 175/300 93/300

stw_logo_small.jpg 72 120 50 120/72 50/72

So please change the the HorizontalResolution and VerticalResolution of the two image with image tools.

Thank you very much for that education in computer graphics. I have taken the image with pixel resolution of 300 pixels/inch and in an image editor have adjusted to a resolution of 72 and then re-adjusted the height and width. I did not understand the difference between Print rendering of an image and HTML rendering.

It appears that the HTML rendering displays the image according to the stated pixel Width and Height regardless of pixel density (resolution), whereas an Excel file uses the Print method of rendering which takes into account the resolution, resizing the image accordingly, as you have shown.

This Support Forum is the best I have ever seen in terms of responsiveness and technical knowledge.

Thanks again...