Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

icon only working on smallest icon size #57

Open
twratl opened this issue May 2, 2013 · 3 comments
Open

icon only working on smallest icon size #57

twratl opened this issue May 2, 2013 · 3 comments

Comments

@twratl
Copy link

twratl commented May 2, 2013

In Windows 7 with ruby version 1.9.2 and ocra version 1.3.0 (update: just updated gem to 1.3.1 and issue still occurs).

I can add an icon using the --icon flag but even though the icon has multiple sizes in it only the smallest size works (in windows the "small icon" or "detail" view).

If it try the "medium" or "large" views the icon defaults back to the standard ruby image.

I have tried multiple .ico files as well.

@peteristhegreat
Copy link

I've had nearly the opposite experience recently. I made my icon using GIMP and Phoca Save Icons scm. Phoca generates many supported sizes: 16,22,32,48,64,128,256,512. When viewing ocra output with the icon flag the smallest size gets replaced with with the ruby gem and all the other sizes work fine with my custom icon. This site describes icon sizes pretty well.

http://www.visualpharm.com/articles/icon_sizes.html

But my issue was with compression and bit depth of the smallest sizes. The default icon looks like it includes: the following:

image

It includes two bpp sizes for each of its supported sizes, 8 bpp and 4 bpp of the sizes 16x16, 32x32, and 48x48, all uncompressed. I gleaned this info by reexporting the icon file as a new icon file, and it showed me those options above.

If you use a resource extractor such as ResEdit, you can strip both ico files from the exe, and it uses all the layers in your custom icon and then reverts to using the second icon if it has a more specific layer in it. I may end up making a better icon generating tool after the exercise.

So end of the story: use an ico file that has at least the same layer attributes as the original, with compression and bit depth matching.

@illtellyoulater
Copy link

I can confirm what @ThomasRawley reported: an icon file passed with "--icon" will only work at the smallest sizes, otherwise the default Ruby icon is used for bigger sizes.

Edit: @peteristhegreat ealier I did not read your comment carefully:

I may end up making a better icon generating tool after the exercise.

Yes, please do, thanks! I would help but I only know some C and I am not familiar at all with Windows executable format.

I think OCRA is at the moment the only working solution to generate an .exe from a Ruby script so it would be definitely useful to have a fully working icon generation tool, plus, one of the first things that people new to scripting languages want to try is generating an exe out of their script to show they have a "compiled" program and probably hide that it came from a scripting language :) (which would give away that the script sources are still available somewhere in memory or on disk...) so showing a plain Ruby icon at higher resolutions really doesn't help to that cause :)
Also, I would doubt they could go through the workaround you discussed above...

So, in the end, if you do it, it would be both good for Ocra and the Ruby language itself :)

@illtellyoulater
Copy link

Just wanted to add that there is another little insidious thing to consider when checking if new icon is correctly showing: you have to take into account the Windows icon caching.

Just deleting "C:\Users\Username\AppData\Local\IconCache.db" isn't enough, you also need to reboot to see changes. But there is another way which doesn't require reboot:

http://superuser.com/questions/499078/refresh-icon-cache-without-rebooting

Just run this command:

ie4uinit.exe -ClearIconCache

..hope it helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants