2

I have a PNG gradient with the same resolution as my screen, 3072 × 1920, and 16-bit color, which renders without banding when viewed full-screen using Preview, but becomes banded when set as the desktop wallpaper. How can I prevent whatever re-encoding is doing this?

I’ve tried exporting the wallpaper as an 8-bit PNG, but that introduces banding even when viewed in Preview. I’ve also tried the sRBG, Display P3, and Color LCD color profiles, and using a TIFF, as well as setting the wallpaper via System Settings, the Finder context menu, and an AppleScript that tells Finder set desktop picture to POSIX file "/example/filename.png".

6
  • 1
    What are the dimensions of the image and the resolution of your screen?
    – Allan
    Commented Feb 15, 2023 at 14:46
  • 3072 × 1920 for both. A good guess, but I don’t think scaling is it, both because the resolutions match and because when it does display without banding, in Preview and in my image editor, it still doesn’t have banding if I zoom in or out.
    – twhb
    Commented Feb 16, 2023 at 0:31
  • Is your Desktop image set to “stretch” or “scale to fit”?
    – Allan
    Commented Feb 16, 2023 at 0:36
  • “Fill Screen”. The other options don’t change it. I just realized something weird, though: while both System Settings and Apple’s specs give this laptop’s resolution as 3072 × 1920, when I take a screenshot it’s 4096 × 2560. So I re-exported the wallpaper at the new resolution, but it’s still banded when set as the wallpaper.
    – twhb
    Commented Feb 16, 2023 at 0:43
  • 1
    4096x2560. This is because your scaled resolution is 2048x1280 and the 'virtual' screen (where all the windows, etc are composed) is always twice the scaled resolution. But, I suspect, that scaling, resolution, etc. is not cause of your problem. I will try and find a statement on this, that the internal 'app' which draws the desktop picture only outputs in 8-bit. This is quite common except for some photo apps and Preview which can match the cloud depth of your display which I assume is 10-bit.
    – Gilby
    Commented Feb 16, 2023 at 4:53

1 Answer 1

1

This is a workaround I’m currently using.

  1. Export the wallpaper as a 16-bit PNG.
  2. View the PNG in Quick Look, not Preview.
  3. Make the Quick Look window fullscreen, then tap an arrow key, hiding the cursor and making the image fully fill the screen.
  4. Take a screenshot.
  5. Use the screenshot as the wallpaper.

This results in a wallpaper without banding.

The screenshot comes out as 4096 × 2560 and 8-bit, despite that the display is 3072 × 1920 and 10-bit. The color profile on both is Color LCD.

I’m not sure what’s going on here. Maybe the wallpaper is always 8-bit, the image actually can work as 8-bit, and the screenshot downsampling code is just better than the downsampling code for wallpapers, Pixelmator Pro, and Affinity Photo. Of note, though, if you open the screenshot then export it using those editors, changing nothing and matching settings, banding appears.

6
  • macOS stores current wallpaper somewhere as compressed JPG (I'm not at the computer and cannot double-check the path but it's buried not very deep). It's likely you can just overwrite that "cache" file and reboot to apply changes.
    – bananakid
    Commented Feb 24, 2023 at 7:50
  • @bananakid, thanks, any advice on finding the path? I searched around ~/Library for a while with no luck.
    – twhb
    Commented Feb 25, 2023 at 3:39
  • Try to lookup file names default.jpg, DefaultDesktop.jpg, wallpaper.jpg (include system files in Stoplight Search). If it fails, attempt this approach (first double-check path is still valid, then disable SIP protection and delete DB file and replace JPG, for sake of reverting things back don't actually delete files but just rename them to .db.backup & .jpg.backup). I'll double-check once I can.
    – bananakid
    Commented Feb 25, 2023 at 9:10
  • Another quick thought to consider is it appears you use MacBookPro16,1 or MacBookPro16,4 like I do. macOS has shitty scale-up & scale-down UI scaling. So if you have 3072x1920 image it will be scaled up with unknown crappy algo to stretch across the actual running resolution (you can check this resolution by taking a full screen screen shot). Try re-scaling your gradient to this "true" resolution or to resolution of default gradients from Apple's HEIC which is 5120x2880 @ 24-bit and saving as JPG or HEIC, then setting as wallpaper. This may fix banding. BTW do you happen to run Boot Camp?
    – bananakid
    Commented Feb 25, 2023 at 9:30
  • Here're unresized 24-bit uncompressed PNG & highest-quality (4×4×4) JPG extracted from Solar Gradients HEIC (gradient #6), check if it's got banding when applied as wallpaper.
    – bananakid
    Commented Feb 25, 2023 at 9:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .