PNG file in imageviewer shrinks and stretches


Attached is a Youtube video of an issue displaying a PNG in both the IDE and during runtime.

In the IDE, part of the image is shown vertically, and changes size when the Window is scrolled. Running the program and load a PNG shows the image at about 1/4 of the size.

Youtube showing issue with sound

Code to show the PNG in the ImageViewer control is shown below.

Is there something that I am missing to show the image?

Thank you.

What is your goal? ImageViewer is a terrible name in my opinion, because it’s an input control. It should have remained ImageWell in my opinion. Whatever the name, it should only be used for indicating to your user, “Yes, please drag and drop an image here.”

I can’t explain the inconsistencies you’re seeing on Windows. I definitely think it’s at least a couple of bug reports.

Circling back, if your only goal is to display an image then I wholly recommend you use a canvas. Canvas offers more control over everything as well.

I hope my tangent doesn’t offend, I’m sorry I don’t have any solutions for your actual problem :frowning:


Apart from the scrolling/display issue in the IDE, in your running app it seems that it‘s due to the DPI settings of the picture. The picture you importet in Xojo is shown with 72 dpi; you assigned it. But if you load the picture by code the dpi real dpi settings stored with the picture will be used. I guess it‘s not 72 dpi. Please check that.

1 Like

Thanks for the suggestion @Carsten_Belling,

The default setting for Windows pictures are 96 dpi and fills in a larger portion of the Image Viewer.

When changing the picture to 72 dpi (Apple default setting), then the loaded picture is the correct size in Xojo 2022 Release 1.1.

It appears that Xojo is using the Apple picture dpi standard for programming on a Windows machine?

Warm regards.

Maybe this is relevant:

1 Like

Thanks for the link @AlbertoD,

I understand why the decision is made to stay at 72 dpi to help make it easier to program the Xojo IDE and executables.

Unfortunately, it makes it difficult when I work with declares, plugins, or any other sort of coding that defaults to Windows standards. Just more work-arounds when trying to program in Windows.

Warm regards.