Imagewell Sizing

I have an image(png) that is part of the project, and I load the image into an Imagewell in the design environment. When I execute the code, the Image is reduced in size approximately 25% on a Mac, but on a Windows machine, there is no change in size. Why does the image size get reduced? the Image well size does not change.

Whats the DPI of the PNG ?

The figure is 300 DPI. When I open it in any viewer, it is the same size as it is in the Xojo design environment. Only when the code is executed on a MAC does the size decrease.

Don’t use a 300 DPI image for starters
You will get inconsistent results because the OS handling - well - in some cases lies to Xojo at design & runtime about the actual PPI
That is assuming the PPI is actually set
There are tools that make you think they set it but really dont. I have one that fooled me into believing it was set but checking it manually and with others tools tells me it didn’t. A update of that tool fixed this issue.

If on Windows you look at Details view you can add the horizontal and vertical PPI as one of the columns and if that says 96 then your 300 DPI image doesn’t actually have it set properly (this is one place to check)
Or open it in Paint.Net which seems to get this right and see what it is there.

Use 72 PPI that is the size you want in the image well
For a “Retina” or hidpi version make it 2x as big BUT STILL 72 PPI
And maybe a 3x version that is 3x as big in all dimensions - but still 72 PPI

Thanks for the support Norm. I had no idea it was so difficult to show a picture. Are there any alternatives to an imagewell. The picture details are:

original size - 263 x 225 Pixels (1.17)
print size - 2.2 x 1.9 cm; 0.9 x 0.8 inches

Its not “difficult” but you do have to be aware of the things that impact it
A 300 DPI image isn’t really useful as it s going to be displayed at 72 DPI
Or worse - sometimes at 72 and sometimes at 96 - neither of which is an even divisor of 300

You could use a canvas and draw it in the paint event with DrawPicture
But the DPI mismatch is still likely to cause you issues
IF you go this route you probably want to use all the parameters to make sure you get a scaled version that uses all the pixels from the original that fills the entire space

Thanks again for the help Norman. I created two versions of the image (72 DPI and 96 DPI), and everything works now if it test for the display type.

Thank you very much for confirmation of the 72 PPI value for “Retina” capable graphics. :slight_smile: