Home > Enterprise >  Create scaled, layered folder icons from multiple images via AppleScript?
Create scaled, layered folder icons from multiple images via AppleScript?

Time:01-07

There are similar answers already on here (like enter image description here


So first we need to find the icon for Notes. We can do that by starting Notes and running:

ps -aef | grep Notes
501 22128     1   0  2:42am ??         0:02.06 /System/Applications/Notes.app/Contents/MacOS/Notes

So now we know Notes lives in /System/Applications/Notes.app


Next we want to find its icon, so:

find /System/Applications/Notes.app -name "*.icns"
/System/Applications/Notes.app/Contents/Resources/AppIcon.icns

So now we know where its icons are, and we can extract the icon as a PNG to our Desktop with:

sips -s format png /System/Applications/Notes.app/Contents/Resources/AppIcon.icns --out ~/Desktop/notes.png

That looks like this:

enter image description here

I chose PNG format because, unlike JPEG, it supports transparency.


Now we can resize that and paste it onto the regular folder icon easily enough with PHP gd (shipped with macOS) or with ImageMagick or with GIMP. I can do that if anyone else can help with the missing aspects.


Next, we can manually set the icon on a folder to the icon of another app and see what that results in. So, find an app in Finder, press I to bring up its info. Select the Fred folder on your desktop and bring up its info the same way. Now click the icon at the top of the first info window to select it, copy with C and then click the icon at the top of the second info window and press V to paste it.

Now go into the folder with the new icon and you will find a file called Icon?:

cd ~/Desktop/Fred
ls
Icon?

We can look inside that with xattr:

xattr Icon*
com.apple.FinderInfo
com.apple.ResourceFork

And we can dump the resource fork with:

xattr -p com.apple.ResourceFork Icon*

I can see there are 8 PNG images in there.

So... the main missing link is how to get the images in that file...

  • Related