I’m trying to add icons for my app’s project files (custom fileytpe). It’s basically the curled corner page with my app’s logo on it. I created it in Photoshop and exported with the background not visible so i get a checkerboard as a background and I check Transparent when I export as a PNG. When I drag it into the icon editor, everything looks fine in the preview but when I create a new project file in my app, I get a black background behind my desktop icon instead of being transparent. The Mask tab in icon editor looks right as it’s black where the icon is and white elsewhere around it. Not sure what I’m doing wrong here. i also get a very garbled looking icon when i go to an open dialog box to open one of its project files. Looks like it’s using a small icon like 16 and trying to enlarge it to whatever the open dialog box uses.
weird. did it the exact same way now i get the transparent background but the icon itself looks really blurry. what size is used on a Mac for a desktop icon?
Did you created all of the icon sizes in the editor?
i also tried recreating the graphics in Adobe Illustrator so they’d be vector-based. Then i exported at the various sizes as screens. That helped with the clarity, but still getting a black background where it should be transparent. Not sure what I’m doing wrong.
In Icon Editor, the Images tab looks like what I end up getting. It’s the image with a black background. The mask looks right as it’s just black where the image is. The preview tab looks right as it’s just the image and the background is checkerboard indicating transparency. So everything looks right. It’s just not making the transparency when it creates a file.
Not sure what you mean “exported … as screens” but try exporting a single 512x512 icon as PNG then drag that to the image box. Let Xojo create the other sizes by dragging that image to the proper boxes. Do the same for your mask. Then see what the preview looks like.
1024 * 1024 (@ 144 dpi) to 8 * 8
For the best results, you should create different icons for each size in the editor and drop them into the corresponding slots. Having the IDE scale then for you will inevitably lead to blurring as pixels are combined.
that is what exporting screens in Adobe Illustrator does. since it’s a vector graphic it can create images at any size as opposed to creating one bitmap image in Photoshop and having the Icon Editor resize them. Here is what I’m seeing in Icon Editor.
A saved desktop icon:
What it looks like when I open this project (in the Open dialog box):
Just to test my graphics, I opened the 1024x1024 in the Preview app, copied it and pasted it into the icon box in the Get Info window for my test project file and it looks right…
so I can’t figure out why when I create a file with that file extension it’s muffing the icon.
I did this for each size icon and they all have the transparent background, so it must be something XOJO is doing to it after I drag them in to the Icon Editor.
If you look at the 8-bit versions, the masks are wrong. In the editor, just drag the 32-bit icons for 48,32 and 16 to their 8-bit equivalents.
They don’t seem to change when I drag them over. Mask stays the same. Tried deleting the 8 bits first also and tried dragging over just the mask, but it still becomes blocky.
Well its always going to be blocky in 8-bit. Those icons have a palette of 256 colors to work from and a 1-bit mask (on or off) as opposed to the 32-bit ones which have over 16 million colors plus a dedicated 8-bit alpha channel.
If your app is only being deployed on macOS, try removing the 8-bit icons altogether.
removed the 8-bit icons but still getting the black around the image when it creates a new file on the desktop.
Im guessing at this point that IconServices isnt updating the icons every time you build. For that to work, you need to make sure that you dont have any other builds of your app with the same or greater short version number (the part that shows major.minor.bug).
The Finder doesn’t update very fast when changing an icon. Try with a fresh VM or rebuild the Launch Services database with Onyx or similar. I never found that the version number matters.
i tried restarting my computer and also rebuilding launch services db via Terminal. no luck. still black background on the desktop icons. I also tried deleting that filetype and rebuilding it. no luck with that either. out of ideas.
Tried running Onyx but it tied up my computer for 45 minutes and was not getting anywhere. Had to restart to stop it.
I think i’m ok. I compiled my app and installed it on a Mojave partition I had on my computer and it created the correct icon there. I actually put a completely different graphic in the icon editor and it still created the last one instead. That pretty much proved to me it was my OS that was muffing it.
it suddenly started to work again after i installed the new version on my computer. I think it was hanging on to the settings from the installed version. when I resave an old project now it puts the correct icon on it. thanks for all the help!