Jump to content

Oddity in resource icons when exporting a workflow


Recommended Posts

I'm not sure if this behaviour is intentional or not, but I've discovered that when Alfred exports a workflow, he destroys any embedded custom icons the files might have had.


Exhibit A:



This is how I had the file in the workflow folder. I'd embedded the icon because certain applescripts require "with icon of file" rather than being able to use the image directly.


However, after re-importing the workflow back into Alfred (or just unzipping it directly in the Finder)...


Exhibit B:



I did wonder if this was just a result of the zipping process. However, if I zip the files with the built-in Mac "Archive" utility, the unzipped version shows the icon as expected.


Is this an intentional space-saving measure, or an unintended consequence/bug?  :unsure:

Link to comment
Share on other sites

Thanks Andrew. Just sent you a PM with a private URL.


FYI, I've been able to replicate this on both Lion and Mountain Lion.




While the file size is smaller, the icon is still intact, going from 270k down to about 15k... but all the other pngs of the same size are also about 15 to 18k in there, so are you sure the original one isn't just a dodgy file which is being 'corrected' during the export?


When I look at icon_alarm.png in the pre-exported and post-exported versions, they look identical.

Link to comment
Share on other sites

I've also changed the title of this bug, as it made me think you were losing all of the icons, whereas it's just something strange going on with one or two icons.


After a bit of analysis, when looking in terminal, the original files have the same size as post-export, so I think something may be messed up with your source resources:


-rw-r--r--@  1 preppeller  staff  201073  6 Feb 20:54 icon.icns
-rw-r--r--@  1 preppeller  staff  253730  5 Feb 07:02 icon_alarm.icns
-rw-r-----@  1 preppeller  staff   15391  6 Feb 23:22 icon_alarm.png
-rw-r--r--@  1 preppeller  staff   19072 28 Jan 06:51 icon_alarm_loop.png
-rw-r--r--@  1 preppeller  staff   20501 28 Jan 06:51 icon_alarm_snooze.png
-rw-r-----@  1 preppeller  staff   19515 28 Jan 06:51 icon_hal.png
-rw-r--r--@  1 preppeller  staff   18320 28 Jan 06:51 icon_loop.png
-rw-r--r--@  1 preppeller  staff   17761 28 Jan 06:51 icon_nuke.png
-rw-r--r--@  1 preppeller  staff   18201 28 Jan 06:51 icon_repeat.png
-rw-r--r--@  1 preppeller  staff   19459 28 Jan 06:51 icon_snooze.png
-rw-------@  1 preppeller  staff   11788 28 Jan 06:51 icon_wtf.jpg


I'd also suggest you run your icons through http://tinypng.org (which you'll notice will also see your 270k icon as a 15k icon). The other advantage is it takes this icon down further to just 5k in size.


I'm pretty sure there isn't an issue here, just some corrupt source resources.

Link to comment
Share on other sites

Thanks Andrew, I'll look into it.


Just to clarify - that icon_alarm.png is the only one of the png files that I'd specifically embedded an icon into. The others are just showing the png preview in the Finder, so they're not changing. But it is happening with any of the files I specifically modify. The reason for the large file size is that I've realised that the utility I was using (img2icn) was upscaling the 128px image into all the different icon sizes, including 512px! So I'll find an alternate way of doing that I think. <_<


I'll go and do another test with a blank workflow and a non-image file with embedded icon and report back if I still can't figure out what's going on. Thanks for your time.

Link to comment
Share on other sites

I think embedding an icon into a png file is a bit of OS X magic as the underlying file in OS X (which Alfred is operating on) is unchanged. You may have to find another way to do this as I'm happier exporting raw files from Alfred to make things as clean as possible.


I'm going to move this to noted instead of a bug as I need to use my time in the run up to v2 release as carefully as possible. Try to be as succinct as possible in any updates to this too!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...