App Icon Getting Darker Over Time?

This is the third time this has happened on this project (or at least that I’ve noticed it), but I think my app icon is getting redrawn in a progressively darker shade at some point over time. That is, the 128px and larger app icon.

You can see the larger versions of the icon are dark and have some posterizing going on in areas of high contrast. The 48px and smaller icons are the correct colors. These all came from the same png file.

I think it’s darkening gradually over time, because I didn’t notice how dark it was until I watched back a screen recording I made a few months ago when it was lighter, but still not the original brightness.

Anyone else experience this? Wondering how to prevent it rather than needing to reload my icons every compile.

What the heck is going on with the larger icons? They have dramatically distorted colors. What does it look like when you build the app?

The icons appear as they do in the screenshot. Once I drag the original png back into each size in the IDE it fixes it, but it’s getting darker over time. Almost like the IDE is re-saving it in a lossy way over and over.

Here’s a screenshot of the icns file from the Resources folder. The larger size is indeed distorted while the small thumbnail shown in the list view is normal.

What do the masks look like?

The masks look as they should. The transparency is coming through fine, just the colors are wrong.

I’m stumped. Perhaps if you caught it at an earlier stage, we could get a better idea of what I’d happening.

Color profiles. Xojo doesn’t support 'em. I seem to recall it does some conversion of colors on opening of an image and if it re-creates image data when you save the project, it would alter the colors the more the project is opened and saved.

A workaround would be to use App Wrapper to include the ICNS file when you use it to prepare your Mac app for distribution.

Towards the end of my life as a Xojo developer, I was avoiding the Picture object entirely and using Apple’s CoreGraphics and NSImage classes for image editing, mainly due to the meta data limitations and the lack of Color Profile support.

1 Like

Thanks Sam, that all sounds logical. The workaround you suggested sounds good except my Windows icons are still affected, so I would need to resolve it within the Xojo IDE anyway. Perhaps there’s a way to do this with a build script.

I have to wonder why there are no other reports of this on the forum. Perhaps it’s a glitch with the particular specs of my source image (32bpp 2600x2600px png), or maybe it actually IS happening to others but again so gradually that it’s hard to notice.

Interesting. Yeah - you really should prepare your icons in, say, Photoshop at the correct pixel dimensions. I’m sure its scaling algorithm is better than whatever is used in Xojo.

It’s at least possible that color profile issues are occurring only if the image needs to be scaled.

You could try copying and pasting the image data from Photoshop. I wonder if that might sidestep whatever is happening; this is how I’ve always done my icons and I’ve never run into this.

You should also make sure that your image hss a valid color profile attached to it.

Also, set your computer on Dark mode and watch your icons… Dramatic :frowning:

Question:

are your icons color change happens also on the created application as see by the Finder ?
If so, did you try to add the Icon dynamically ?
(not using Xojo Icon Editor)

It hasn’t happened to me, but then I haven’t used Xojo’s icon editor for a very long time. There was a problem at some point with in, and I got around it by using App Wrapper, so I never bothered with it since. I just opened Sleep Aid’s icon in App Wrapper and they look as good as the day I added them.

There is a macOS app “Icon Composer 2x” to make icns files. It’s easy to add the icns files with a build script. Makes the Xojo files much smaller and saving so fast.

3 Likes

Couldn’t you strip the color profile from the png or use the correct one? I have never had this problem.

Definitely don’t want to remove the color profile - if Sam is right, this is already the problem.

… why not if it’s causing a problem?

1 Like

My guess is that Xojo is reading the icon binary data into a Xojo Picture and then converting back to binary data either each time the project is opened / saved or possibly each time the icon editor window is opened / closed.

If I’m correct, there could be two things happening:

  1. An ICC colour conversion is being performed.
  2. The pixels are being converted to the premultiplied alpha channel format.

Neither operation is 100% reversible which means you would get a slight change each time this occurs.

Nasty!

2 Likes

Because if anything, it’s the LACK (or disregard) of a color profile that’s to blame here. See Sam’s comments above.

Or a bug as Kevin suspects. Much like as if you recomputed a lossy compression on every save, over time the image quality would be compromised and it would get increasingly blurry.

In the case recomputing the color bits over and over, on the resulting set, not the original one, using the color profile. Color degradation.

To be clear, the source image was created in Photoshop and has the standard sRGB IEC61966-2.1 profile. It is admittedly 2.5x the largest size it’ll ever need to be so perhaps downscaling has something to do with this issue as well.

Is this worth opening a case for? I don’t know how to reproduce it, I only know that it’s happened a few times on this one project.

Definitely worth a case report, and some further experimentation to narrow it down if you can.

1 Like