Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

JTelcontar

macrumors newbie
Original poster
Apr 14, 2013
8
0
Hoping someone here might have some more information for me or be able to point me in the right direction.

I've got an RTF file I was wanting to set a custom icon for. The RTF file is about 2 KB. The transparent PNG I'd like to use is 5 KB and 161x148 pixels (72 px/in). When I open the PNG in Preview and then copy/paste into the icon from the Get Info window, it correctly replaces the icon and looks great. But the RTF's file size increases to 1.1 MB. I tried the custom icon on some other random files, and they all increased to 1.1 - 1.5 MB.

I can understand the file increasing by more than the 5 KB of the PNG file, but I was shocked at how much larger it was.

I was hoping to read some additional information about why it increases so much. Is this just the "default" minimum size now for custom icons? Is there a better way to set the custom icon that won't increase like this with such a small original PNG file?

I'm on the latest version of macOS Ventura if that helps.

Thanks for any suggestions!
 
I just did another test with a PNG I created in GIMP (200x200 pixels, 12 colored circles, transparent background). I ended up with a 5 KB PNG. Added it to a small test RTF (< 1 KB) ended up with a 500 KB file. That still seems like a really huge increase for two small files.
 
A not entirely precise answer:
Icons are stored in a Resource Fork associated with the file. This is a sort of general purpose bucket that can contain lots of different types of data. There must be some overhead in setting up a resource fork (I don't know what). In addition, I am pretty sure the icon is not stored in a compressed format (like PNG), so I would expect a large increase in size.
Conclusion: Enjoy your icons and don't worry about the size. ;)
 
  • Like
Reactions: JTelcontar
A not entirely precise answer:
Icons are stored in a Resource Fork associated with the file. This is a sort of general purpose bucket that can contain lots of different types of data. There must be some overhead in setting up a resource fork (I don't know what). In addition, I am pretty sure the icon is not stored in a compressed format (like PNG), so I would expect a large increase in size.
Conclusion: Enjoy your icons and don't worry about the size. ;)
Ahh gotcha about the compressed format... I didn't consider that. Will need to do a little research about it and see if maybe there's another way to generate an image that wouldn't increase nearly as much, even if the image quality isn't as "nice" as PNG.

Haha, yeah, I might just suck it up and use them anyway. Was just really surprised at the file increase. :)
 
A custom icon on a file adds an 'icns' resource to the file's resource fork. If the file doesn't have a resource-fork yet, then one must be made for it. A resource fork with no resources, only a resource map, isn't all that big, but it might be at least 1KB or so, which would probably make a noticeable increase to a 2KB file.

As I recall, an 'icns' resource can be quite large; I think it's an uncompressed set of raster images of different dimensions. I vaguely recall that dimensions up to 128x128 are possible. These days, the dimensions might be even larger.

You can derez the resource-fork and see what's in it:

More history & details here:
 
  • Like
Reactions: JTelcontar
@chown33 Oh awesome, thanks for the additional details about derez. I'll have to play around with that.


Appreciate the information from the replies; you all are definitely helpful!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.