HiDPI show wrong size of picture

  1. ‹ Older
  2. 2 months ago

    Horst J

    Feb 15 Pre-Release Testers, Xojo Pro Europe, Germany, Stuttgart
    Edited 2 months ago by Horst J

    Now I have made a new application with the same pictures. The new complied Linux 64 Bit application looks good. The picture has the same size. I have checked this with a compiled version one made on a Mac and the other one made on Windows. I got the same result. All pictures a drawn correct.

    I have deleted the pictures in my old project and made a new picture with the same graphics files. After I have compiled my app for Linux, I got the same wrong picture size.

    After I have cleared the application cache, removed the complete build folder and compiled the app, I got the same image problem. When I check the folder "Resources", the image with the double size was renamed to "RedHat128@2x.png" and the normal size has the same name "RedHat128.png. But when I check the resolution for both pictures, I got 96 x 96 DPI.

    Also I have checked my new Linux Test App. On mac the images in the resources folder has the same resolution of 72 x72 DPI. On Windows they have 96 x 96 DPI.

  3. Emile S

    Feb 16 Europe (France, Strasbourg)

    AFAIK (and I can be wrong), the resolution (dpi) of the two files cannot be the same / the size (width / height) have to be the same.

    My advice:

    take your orginal file and:

    set the @2x image to 144dpi
    set the “@1x” image to 72dpi

    Both images have the same x, y values.

    Replace the current image by these new ones and run.

    When you know, it is not really easy to explain these things. And once you know… things are not easy to explain too, so one can share bad / wrong / not completely true… explanaton. :(

    The problem (to understand) lies in the fact Photoshop (by example, but not only) propose by default to “display all pixels” even if the Pixels are <> from Points: the image appears two (or more) times larger than the “display points” settings. Note that I do not have used Photoshop since… ages, so the names can be different.

    About 72 and 96 dpi: these are the default resolution (in dpi) for each OS (72: macOS; 96: Windows).
    When ou open a 96dpi image in Preview, make a copy / newand compare the results: one image will be "larger" than the other. With Copy / Paste / New, Preview does not always know / support/ respect the original resolution (72 /96 / 144…).

    Another simple test you can do is on macOS: take a non 72 dpi image , open a window, open the “Show the presentation options” (translated from French, so the english sentence can be a bit different), click in the Image --> Background and drop that image into the graphic area.
    The Finder will display the image accordingly to its dpi: smaller or larger of the standard size (72 dpi) depending on its real dpi value.

  4. Horst J

    Feb 16 Pre-Release Testers, Xojo Pro Europe, Germany, Stuttgart

    Hi Emile, thanks for your answer.

    In all my project I use images with 72 x 72 DPI for @1 and @2 pictures. This works on macOS, (with and without Retina Display), iOS, Windows and Linux. When I compile my apps on my Mac all images in the resources folder for all applications have the same resolution of 72 x 72 DPI for each size @1 and @2. When I compile these apps with Xojo on an Window machine, I got the problem that all pictures have 96 x 96 DPI in the resources folder of the compiled Linux app folder. I think this is a bug in the windows release of Xojo 2016 R4.1

  5. Greg O

    Feb 16 Xojo Inc Somewhere near Raleigh, NC

    @Horst J Both images has 72 DPI.
    -image-

    -image-

    My application is build for Windows and Linux. On Windows platform the picture is correct drawn, only on Linux (RedHat or Ubuntu) the picture are drawn with the wrong size.

    Please check the values from inside your paint event. The Graphics object has both ScaleX and ScaleY properties and I'd like to know if the Xojo Framework has changed the resolution of those images at runtime.

  6. Horst J

    Feb 16 Pre-Release Testers, Xojo Pro Europe, Germany, Stuttgart

    The picture size on runtime shows also 72 x 72 DPI. But you can seen in the screenshot the picture is too big (creater than 128 pixel). When I replace the pictures in the resources folder with the original pictures (with 72 DPI) an restart the application the image is drawn perfect.

    Example: Image is greater than 128 pixel, but resolution shows always 72 DPI
    -image-

    Example: replace images in the resources folder
    -image-

    -image-

    -image-

    -image-

  7. Ulrich B

    Feb 16 Pre-Release Testers, Xojo Pro Xojo Deutschland-Evangelist ·...
    Edited 2 months ago by Ulrich B

    Do you use imagesets or are you manually assigning different images?

  8. Horst J

    Feb 16 Pre-Release Testers, Xojo Pro Europe, Germany, Stuttgart

    -image-

  9. Ulrich B

    Feb 16 Pre-Release Testers, Xojo Pro Xojo Deutschland-Evangelist ·...

    I tried to duplicate the issue with a simple app, built on Mac and Windows for Linux 64Bit, but I cannot – everything looks good. Could you send a link to a demo project of yours where this problem occurs?

  10. Horst J

    Feb 16 Pre-Release Testers, Xojo Pro Europe, Germany, Stuttgart

    The problem exists only if you use HiDPI pictures in your project and build you app for Linux on Windows platform. If I use same project with the same pictures on macOS to build my app for Linux, there is no problem.

  11. Greg O

    Feb 16 Xojo Inc Somewhere near Raleigh, NC

    I give up. If you think there's a bug, file a report in Feedback with a reproducible example project and we'll get it looked at.

  12. Emile S

    Feb 16 Europe (France, Strasbourg)

    Horst:

    the two images have to have the same width and height, but different DPI.

    What you say you have now is two images with different width and height and same DPI and this is wrong.

  13. Horst J

    Feb 17 Pre-Release Testers, Xojo Pro Europe, Germany, Stuttgart

    This is the current status:
    Original image file no. 1:
    RedHat128 (128 x 128 pixel and 72 x 72 dpi)

    Original image file no. 2:
    RedHat256 (256 x 256 pixel and 72 x 72 dpi)

    Create an image-set in Xojo and drop image no. 1 into @1 and drop image no. 2 into @2

    Add a canvas to window1, select RedHat128 from then pop-up menu. Build it on Windows platform for Linux 64 bit. After this all images in the applications resources folders have 96 x 96 dpi. Also the the images for @1.

    If you build this app on macOS for Linux 64 Bit. All images has 72 x 72 dpi and the application shows the correct images.

    If I add a toolbar to window1, all images 32 x 32 pixel for @1 (and 64 x 64 pixel for @2) are drawn correct in the app, when i build this on a Windows machine for Linux 64 bit. But the images for the toolbar in the applications resources folder has 96 x 96 dpi.

  14. Emile S

    Feb 17 Europe (France, Strasbourg)
    Edited 2 months ago by Emile S

    This is where the application troubles are:

    Original image file no. 2:
    RedHat256 (256 x 256 pixel and 72 x 72 dpi)

    The real value have to be:

    Original image file no. 2:
    RedHat256 (128 x 128 pixel and 144 x 144 dpi)

    If you do not know how to generate such an image, just ask.

    About 96 x 96: beside the value is not what you’ve done, does it hurts the program ?
    If not, just forget about it.

    Edit:
    A good question is… How do you get the 256 x 256 image (Original image file no. 2) ?

  15. Horst J

    Feb 17 Pre-Release Testers, Xojo Pro Europe, Germany, Stuttgart

    When I create a picture with 128 x 128 pixel and 144 x 144 dpi, I got a warning in the IDE:
    "Current image is 128 x 128 @ 144 ppi and will be scaled"

    When I build the app with this picture on Windows platform for 64 Bit Linux, I got the same wrong result. The picture fits not in the canvas area.

  16. Emile S

    Feb 17 Europe (France, Strasbourg)

    OK.

    Stupid question: what is the used Xojo version ?

  17. Horst J

    Feb 17 Pre-Release Testers, Xojo Pro Europe, Germany, Stuttgart

    2016 R4.1 platform Windows 7 Professional

  18. Emile S

    Feb 17 Europe (France, Strasbourg)

    Strange.

  19. Greg O

    Feb 18 Xojo Inc Somewhere near Raleigh, NC
    Edited 2 months ago by Greg O

    @Horst J When I create a picture with 128 x 128 pixel and 144 x 144 dpi, I got a warning in the IDE:
    "Current image is 128 x 128 @ 144 ppi and will be scaled"

    When I build the app with this picture on Windows platform for 64 Bit Linux, I got the same wrong result. The picture fits not in the canvas area.

    Yes, that's exactly right. It should be 128x128 @ 72ppi and 256x256 @ 144ppi. Basically, if you take the width or height and divide it by the ppi, you should get the same ratio, so:

    256 / 144 = 128 / 72 = 1.777777777777778
  20. Horst J

    Feb 18 Pre-Release Testers, Xojo Pro Europe, Germany, Stuttgart

    When I read the documentation for HiPDI Support , I see that my images of an image set should have the correct dpi 144 or 266 when PropertyValue("App.SupportsHiDPI") = "False".

    When SupportsHiDPI is turned OFF, the framework will continue to work the way it did before. Images that use @2x or @3x in the name will have their PPI adjusted accordingly (144ppi, 216ppi).

    When It is always needed to have the hi-dpi 144 and 216 (for @2 and @3), so please update the documentation.

    My last question is always the same:
    Why I build my Linux app on macOS platform, I don't have any problem with the picture size or dpi. Only when I build my Linux app on windows, the problem with the pictures exists. I think this is a bug on the windows build on Xojo.

  21. Greg O

    Feb 18 Xojo Inc Somewhere near Raleigh, NC

    Since the Xojo ide is built with Xojo, it'd either be a windows framework bug or a Windows ide bug.

or Sign Up to reply!