{"id":49469,"date":"2025-10-02T18:09:42","date_gmt":"2025-10-02T22:09:42","guid":{"rendered":"https:\/\/mjtsai.com\/blog\/?p=49469"},"modified":"2025-10-02T18:12:55","modified_gmt":"2025-10-02T22:12:55","slug":"how-to-export-a-mac-icon-file-with-the-proper-margins","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2025\/10\/02\/how-to-export-a-mac-icon-file-with-the-proper-margins\/","title":{"rendered":"How to Export a Mac .icon File With the Proper Margins"},"content":{"rendered":"<p>Tahoe Mac app icons are supposed to have margins\/padding so that there&rsquo;s empty space around the edge of the squircle. The opaque pixels don&rsquo;t touch the edge of the canvas. Icon Composer and Xcode handle this detail for you. You design your icon without having to worry about the margin, and Xcode automatically adds it when compiling your asset catalog.<\/p>\n\n<p>The issue is, how do you get the proper margin on icon images used in other contexts (documentation, marketing, etc.)? If you export from Icon Composer, it generates PNG files with no margin, so the icon appears too large, even though the outer pixel dimensions are the same. For example, on the <a href=\"https:\/\/c-command.com\/spamsieve\/screenshots\">SpamSieve screenshots page<\/a>, the Light icon is generated by Xcode, and the Dark\/Clear\/Tinted variants are exported from Icon Composer. The difference is substantial.<\/p>\n\n<p>I posted about this <a href=\"https:\/\/mastodon.social\/@mjtsai\/115304823124540239\">on Mastodon<\/a> and also found an old post <a href=\"https:\/\/developer.apple.com\/forums\/thread\/788830\">in the Apple Developer Forums<\/a>, but no one seemed to know the answer.<\/p>\n\n<p>Back in June, I learned from <a href=\"https:\/\/micro.virtualsanity.com\/2025\/06\/20\/icon-composer-notes.html\">John Brayton<\/a> that you don&rsquo;t have to manually export from the Icon Composer app. It has a command-line tool called <code>ictool<\/code> (formerly <code>icontool<\/code>) that can convert <tt>.icon<\/tt> files to <tt>.png<\/tt>. So I have a Makefile that generates all the different sizes and variants for all my apps using commands like this:<\/p>\n\n<pre>\"\/Applications\/Xcode.app\/Contents\/Applications\/Icon Composer.app\/Contents\/Executables\/ictool\" AppIcon.icon --export-preview macOS Light 128 128 1 AppIconLight.iconset\/icon_128x128.png<\/pre>\n\n<p>Unfortunately, <code>ictool<\/code>, like Icon Composer itself, does not add the transparent margin.<\/p>\n\n<p>I checked Xcode&rsquo;s build log to see if there were other options it was passing but didn&rsquo;t find anything. It looks like it&rsquo;s not using <code>ictool<\/code> and instead compiles the icon directly into the asset catalog.<\/p>\n\n<p>So far, the only solution I&rsquo;ve found is to actually build my app with Xcode and then extract the icons it generated. You can view the contents of an asset catalog using <a href=\"https:\/\/github.com\/NSAntoine\/Samra\">Samra<\/a>, but it doesn&rsquo;t export. <a href=\"https:\/\/github.com\/insidegui\/AssetCatalogTinkerer\">Asset Catalog Tinkerer<\/a> has some export problems&mdash;it shows constituents of the <tt>.icon<\/tt> as having the same name and only exports one of them&mdash;but it&rsquo;s fine for the purposes of extracting the fully rendered icons.<\/p>\n\n<p>The method I prefer is to take the <tt>.icns<\/tt> file in the <tt>.app<\/tt> package and use <code>iconutil<\/code> to convert it to a folder of PNGs:<\/p>\n\n<pre>iconutil -c iconset -o AppIcon.iconset AppIcon.icns<\/pre>\n\n<p>Note that, by default, Xcode only generates the <tt>.icns<\/tt> file with sizes up to 256px. To get the larger sizes, you need to add to your <tt>.xcconfig<\/tt> file:<\/p>\n\n<pre>ASSETCATALOG_COMPILER_STANDALONE_ICON_BEHAVIOR = all<\/pre>\n\n<p>Unfortunately, relying on Xcode to apply the margins only works for the standard (Light) icon. This is the only one that it pre-generates. If you know how to get it to compile Dark\/Clear\/Tinted variants&mdash;or how to properly export those directly without using Xcode&mdash;please let me know.<\/p>\n\n<p>Previously:<\/p>\n<ul>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2025\/08\/08\/separate-icons-for-macos-tahoe-vs-earlier\/\">Separate Icons for macOS Tahoe vs. Earlier<\/a><\/li>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2025\/06\/23\/icon-composer-notes\/\">Icon Composer Notes<\/a><\/li>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2025\/06\/19\/macos-tahoes-new-theming-system\/\">macOS Tahoe&rsquo;s New Theming System<\/a><\/li>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2023\/03\/06\/samra-1-1\/\">Samra 1.1<\/a><\/li>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2020\/04\/29\/actool-strips-larger-icon-sizes\/\">actool Strips Larger Icon Sizes<\/a><\/li>\n<\/ul>","protected":false},"excerpt":{"rendered":"<p>Tahoe Mac app icons are supposed to have margins\/padding so that there&rsquo;s empty space around the edge of the squircle. The opaque pixels don&rsquo;t touch the edge of the canvas. Icon Composer and Xcode handle this detail for you. You design your icon without having to worry about the margin, and Xcode automatically adds it [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"2025-10-02T22:09:44Z","apple_news_api_id":"ea82852e-fb4f-4c74-9f7c-12a5c6691f1f","apple_news_api_modified_at":"2025-10-02T22:12:58Z","apple_news_api_revision":"AAAAAAAAAAAAAAAAAAAAAA==","apple_news_api_share_url":"https:\/\/apple.news\/A6oKFLvtPTHSffBKlxmkfHw","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[2],"tags":[73,2352,619,2783,545,2785,30,2742,1661,71,226],"class_list":["post-49469","post","type-post","status-publish","format-standard","hentry","category-technology","tag-icns","tag-asset-catalog-car","tag-graphics","tag-icon-composer","tag-icons","tag-liquid-glass","tag-mac","tag-macos-tahoe-26","tag-png","tag-programming","tag-xcode"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/49469","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=49469"}],"version-history":[{"count":2,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/49469\/revisions"}],"predecessor-version":[{"id":49471,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/49469\/revisions\/49471"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=49469"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=49469"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=49469"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}