tauri-apps/tauri

[bug] dmg background DPI issues

RandomEngy opened this issue · 0 comments

Describe the bug

Currently in order to get a custom background working, you must make your image pixel dimensions match the window dimensions. However, this doesn't take DPI into account.

The default size is 660x400. I made an image that size, and it worked. However the image looks bad since it's not displaying at the display's higher DPI: that image is being stretched over an area of 1320x800 physical pixels.

It would be nice if you could give an image with the correct aspect ratio at 2x or 3x of the window dimensions, so it can look more crisp. If you try that now, it will just cut off most of the image. I think making the window non-resizable and having the background image stretch to the window size would help.

It would also be nice if the docs told you what the default window dimensions and recommended image size were.

Reproduction

  1. Create a dmg high res background image with 1320x800 pixels.
  2. Create an dmg bundle with the image:
"dmg": {
  "background": "../../app-icons/DmgBackground.png",
  "windowSize": {
    "height": 400,
    "width": 660
  }
}
  1. Observe the created window cuts off the high-res image and shows it as too large and blurry.

Expected behavior

The image is not cut off and is displayed crisply on high-DPI displays.

Full tauri info output

[✔] Environment
    - OS: Mac OS 15.2.0 arm64 (X64)
    ✔ Xcode Command Line Tools: installed
    ✔ rustc: 1.82.0 (f6e511eec 2024-10-15)
    ✔ cargo: 1.82.0 (8f40fc59f 2024-08-21)
    ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
    ✔ Rust toolchain: stable-aarch64-apple-darwin (default)
    - node: 22.8.0
    - pnpm: 9.1.4
    - npm: 10.8.2

[-] Packages
    - tauri 🦀: 2.1.1
    - tauri-build 🦀: 2.0.3
    - wry 🦀: 0.47.0
    - tao 🦀: 0.30.8
    - @tauri-apps/api : not installed!
    - @tauri-apps/cli : 2.1.0

[-] Plugins
    - tauri-plugin-single-instance 🦀: 2.0.1
    - @tauri-apps/plugin-single-instance : not installed!
    - tauri-plugin-window-state 🦀: 2.0.2
    - @tauri-apps/plugin-window-state : not installed!
    - tauri-plugin-shell 🦀: 2.0.2
    - @tauri-apps/plugin-shell : not installed!
    - tauri-plugin-os 🦀: 2.0.1
    - @tauri-apps/plugin-os : not installed!
    - tauri-plugin-deep-link 🦀: 2.0.1
    - @tauri-apps/plugin-deep-link : not installed!
    - tauri-plugin-notification 🦀: 2.2.0
    - @tauri-apps/plugin-notification : not installed!
    - tauri-plugin-log 🦀: 2.0.2
    - @tauri-apps/plugin-log : not installed!

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../dist
    - devUrl: http://localhost:5173/
    - bundler: Rollup

Stack trace

No response

Additional context

No response