Skip navigation
This discussion is archived

Using an ICNS File

1604 Views 3 Replies Latest reply: Dec 16, 2006 7:43 AM by MrGuilt RSS
MrGuilt Calculating status...
Currently Being Moderated
Dec 15, 2006 8:40 PM
Hi!

I've been struggling with this problem for weeks now, and would benefit from some help.

If I have an icon from file A, I can apply it to file B by copy/paste from the icon in the upper-left corner of the info dialog. I have that down pretty well.

I have created an ICNS file for an icon. I used GIMP to create the basic image (with a transparent layer), and tiff2icns to convert it to the correct format.

However, this comes in as a file to use the Preview application. Though I see a thumbnail in Finder, the Info dialog shows the info for the type of file (A piece of paper with "ICNS" on it). If I copy/paste that icon, it shows up with the generic icon.

If I launch the file in preview and copy/paste, it applies OK, except that transparent pixels cease to be transparent.

So, how do I apply the ICNS file to a file or folder?

thanks,
Charles

MacBook   Mac OS X (10.4.8)  
  • Charles Minow Level 6 Level 6 (9,190 points)
    Currently Being Moderated
    Dec 15, 2006 10:14 PM (in response to MrGuilt)
    Hi--

    Welcome to the Apple Discussions.

    Hmmm. I figured out a way, but it's kind of a long way around. It might be simpler just to buy Folder Icon X for $15 and be done with it.

    I noticed the same thing you did: that the transparent pixels aren't transparent when you copy/paste from Preview. It appears that Preview doesn't copy the mask information (transparency). But, if you have a folder icon with transparency already, you can copy with the transparency. So here's what I did:

    1. Create an icon in Photoshop. Save it as a TIFF with an alpha channel.

    2. Use tiff2icns to change it to an icns file.

    3. Use the Terminal to copy the icns file to the root level of a disk partition:

    <pre class="command">cp ~/Desktop/test.icns /Volumes/VolumeName/.VolumeIcon.icns</pre>Note the filename, that's important: .VolumeIcon.icns.

    4. This is where it gets kind of ugly. The Finder still doesn't realize the folder Icon has been changed, because you did it more or less behind its back, and the custom icon bit doesn't get set. If you have the Developer Tools (Xcode) installed, you have a couple of utilities in /Developer/Tools/ to look at files. You don't need them for this step but you do for the final one. To verify that the bit is not set, run GetFileInfo on the volume:

    <pre class="command">/Developer/Tools/GetFileInfo /Volumes/VolumeName</pre>You'll get back something like this:

    <pre class="command">directory: "/Volumes/VolumeName"
    attributes: avbstclinmedz
    created: 11/07/2006 04:58:24
    modified: 12/15/2006 22:56:37</pre>It's the "c" in there. man GetFileInfo will cough up the goods on those attributes.

    5. For this step, you have to have Xcode tools installed. You reset the custom icon bit on your volume:

    <pre class="command">/Developer/Tools/SetFile -a C /Volumes/VolumeName</pre>Once you click on the volume the Finder will refresh and show you your new Volume icon in all its masked, semi-transparent glory.

    6. Now do your usual "Get Info" window dance, copying the icon from the disk partition's "Get Info" window to your folder's. Presto change-o, you have the same icon on our folder, because the Finder apparently does copy all the mask information...

    charlie
    PowerBook G4, Mac OS X (10.4.8)
  • Francine Schwieder Level 6 Level 6 (19,000 points)
    Currently Being Moderated
    Dec 15, 2006 11:20 PM (in response to MrGuilt)
    The easy way is to download icns2icon:

    http://www.icons.cx/goodies/

    Drop your icns file on it and it creates a regular custom icon for the file, which can be copied and pasted in the normal way from the GetInfo window of the file.
    Francine


    Francine
    Schwieder
    G4 Dual 800; iBookG4; iPod, Mac OS X (10.4.8)

Actions

More Like This

  • Retrieving data ...

Bookmarked By (0)

Legend

  • This solved my question - 10 points
  • This helped me - 5 points
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with or related to your use of the site. All postings and use of the content on this site are subject to the Apple Support Communities Terms of Use.