I have updated an old app with the new release 2016R1. I have two pictures in a listbox.
I just enable HDPI for this project and dropped the pictures to the project. I also dropped the picture in resolution for 2x and 3x (16 pixel, 32 pixel and 48 pixel). When I rund this app in debug or build it for 32bit/64bit, I got this wrong picture for the “male16.png” on a Mac without Retina display.
I found the problem for the “male16.png”. The picture “male16.png” and “email@example.com” has a resolution of 72 DPI and “firstname.lastname@example.org” has a resolution of 443 DPI. After I changed the resolution for picture “email@example.com” to 72 DPI the icon will be correct drawn in the listbox.
Why this is a problem for Xojo? The picture “firstname.lastname@example.org” is not in use for a non Retina display.
hard to say without seeing your images
what size & ppi are they ?
this really matters now
male16 = 16x16 pixel (72 DPI)
male16@2x = 32x32 pixel (72 DPI)
male16@3 = 48x48 pixel (443 DPI)
male16 = 16x16 pixel (72 DPI)
male16@2x = 32x32 pixel (144 DPI)
male16@3 = 48x48 pixel (216 DPI)
How does one even specify the DPI? Is that included in the image file (do all img formats do that, even BMP?)
Or is that something one specifies in the IDE for each img?
Meta data in a PNG.
You could also set it in code if you are loading images that way. There’s an example SetImageResolutionFromName method here: http://developer.xojo.com/hidpi-support
the only thing that should be of any concern is Pixels and/or Points
Normally one deals with a graphic (especially something relatively small like an icon) in “pixels”
16x16 , 32x 32 or 48x48
Now where the points come in would be more related to the device…
non-Retina would be 1:1, 1 point=1 pixel, or 1 pixel = 1 point
standard Retina would be 2:1, 1point=2 pixels or 1 pixel = 1/2 point (ie. a 32x32 PIXEL image would display in a 16x16 POINT area)
the same would be true for @3x (iPhone 6+ for example), 1 point=3 pixels and a 48x48 PIXEL image would display in 16x16 POINT area)
DPI is related to a specific device, every monitor is different, and even every iPhone is different, which is why POINTS is the standard unit of measure.
In whatever tool you use to create the image
I know many have a way to specify it
Sketch, the tool we used to create vector images, allows us to export to specified formats like PNG at a certain ppi
Graphic Converter has a way to edit / change this as well
Now I have found the problem. My picture men16.png has a resolution of 72 DPI in all sizes (1x, 2x and 3x), but when I build the app. the picture email@example.com has a resolution of 443 DPI.
This is the original picture from my source folder:
This is the picture after build the app from the resource folder of the builded application:
both say 72 pixel per inch ?
When I copy the original firstname.lastname@example.org into the applications resource folder, the icon has the correct size in the running application.
When I run the app in debug mode or build app, the picture has the wrong size.
Uh, I can’t spot the difference in the two pics, Horst.
Sorry, was the wrong link. Now one picture has 72 DPI and the other 443 DPI.
You don’t need 3x in a OS X desktop app. What happens if you have 1x/2x in the proper DPI and remove the 3x?
According to your screenshot both your @3x and @1x are called
Could that be it?
Is see the issue. Make a FR with an example please.
The picture men16.png, men16@2x and men16@3x was made with default preview application of Mac OS X. And it was scaled down from a PNG file with 512x512 pixel and a resolution of 72 DPI. All these three scaled picture has a resolution of 72 DPI. This is the information from Adobe Photoshop:
I don’t know why Xojo rescale the picture to 443 DPI. I think the first solution is that what Travis says. I removed the picture for 3x in the IDE.
This solves the problem.
But I have many applications that would build for Windows, Mac OS X and iOS. For iOS we need the picture in 3x resolution. When using my pictures from a project on OS X and iOS we must change all pictures in the IDE this is not a good solution.
You should still make a sample in a Feedback report when you can, so we can help determine what was wrong with this particular use of 3x. I just wanted to help you on your way for now.
[quote=257840:@Thomas Tempelmann]How does one even specify the DPI? Is that included in the image file (do all img formats do that, even BMP?)
Or is that something one specifies in the IDE for each img?[/quote]
Almost all supported image formats, including BMP, have some kind of metadata to describe the DPI. The only one I’m aware of that doesn’t is TGA.
The information can be read and manipulated through a Picture’s HorizontalResolution and VerticalResolution properties.