-
Notifications
You must be signed in to change notification settings - Fork 302
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
Use Resource Hacker instead of rcedit #44
Comments
I like this solution but only if we were able to bundle the executable. I would hate to create an external dependency for this. Have you ever used this https://github.com/geo8bit/nodebob/tree/master/buildTools/ar? |
What if you are on a Mac and you want to make a windows version, how are you going to run that .exe application? |
@RobinMalfait currently Wine is required to use the existing rcedit solution. That surprisingly works while running from Windows directly does not. This is still not ideal as there is the hanging external dependency. Any ideas for making this work cross platform without creating a dependency requirement would be very appreciated... :) |
@gabepaez it would be nice to have 1 tool cross platform instead of Wine & rcedit, if I find something i'll let you know ;) |
Well, the wine solution isn't bad at all I have to say. However as said, rcedit generates the wrong icon headers so your icons will ALWAYS look ugly on Windows |
It's not only rcedit which generates shitty icons, but also resourcehacker. If you're compiling your app for windows and you want to replace the icon with an ico file which embeds multiple icon sizes, both seem to fail. Just adding a 128x128 or a 256x256 icon will result in a very poorly downsampled 16x16 icon. That's the reason why I've skipped changing the icon for my app. |
hu? At least for me it works perfectly with Resource Hacker and multiple icon sizes in one icon file. Doing that afterwards in Windows via Resource-hacker -> replace icon makes it perfect and generates the correct headers (the first icon header is simply wrong as it contains a single image definition only when using rcedit) |
@bastimeyer @quasado
with a multiple sizes icon file. The result is perfect. For my own use I wrote a node wrapper for resourcehacker that works under linux & OS X with wine installed.
|
@gabepaez
The pros:
The cons:
|
@felicienfrancois Yeah I know... I've created the multisampled icon with ImageMagick ( |
@felicienfrancois is Resourcer.exe able to add the multiple icon sizes contained in the ico correctly without downsampling as @bastimeyer describes? |
@gabepaez yes Resourcer worked with a multiple icon size file correctly without downsampling. |
The main issue of rcedit is that it does not take any "path of ressource". The node-webkit binary have by default a single size icon (48*48) on the path Setting an icon with rcedit do the following:
I don't know why and how it does that, maybe an index issue but it does not do the job correctly as windows ignore the Both resourceHacker and Resourcer.exe take a "resource path" argument and succeed in keeping all the icon sizes. Unlike the command line given by quasado in the first post, the "resource path" to edit must be |
Yes, that's exactly the issue. RCEdit should actually replace the IDR_MAINFRAME with the multiple icon sizes to work correctly. So, for now, this renders the winIcon property of node webkit builder pretty useless :( I'd still vote for using Resource Hacker to make it working correctly? |
Alright, I am all for replacing RCEdit with (Anolis Resourcer)[http://anolis.codeplex.com/] for now. This should be relatively easy and gives us a stop gap that will at least work properly on all platforms (with Wine). Does anyone have some time to implement? |
@gabepaez 2°) I wrote a nodejs wrapper for resource hacker that work perfectly. I have just sent an email to Angus Johnson to ask him for permission to distribute Resource Hacker with the wrapper. Maybe we could wait for his answer to choose. 3°) If we choose Anolis Resourcer, I can write the wrapper as it will just be a copy/paste of my wrapper of Resource Hacker |
I just did some testing and though Anolis Resourcer does seem to work using a default install of wine on osx it appears to have the same issue as rcedit where the generated icon looks downsampled and jagged. We might need to hold out for Resource Hacker @felicienfrancois. |
@gabepaez Anyway, that's strange you found that anolis downsampled the icon whereas it worked for me. |
I am just running wine 1.6.2 installed via Brew. It's possible my ico file is not in a quality format. I created it online using some random tool. I will try to find a better pre-exisiting ico out there and run it through Resource Hacker too. |
I just wrote a wrapper for Anolis Resourcer: https://github.com/felicienfrancois/node-winresourcer It could be used for node-webkit using the following code:
|
I am all in for integrating Resource Hacker when permission (hopefully) arrives. It doesn't require .NET and it works just perfectly. Adding another .NET layer on top of wine to just replace an icon seems to be.. erm.. overengineered :D |
@quasado I agree with you but I would like to share with you some new information I have about Anolis Resourcer. I found the documentation and it includes a comparison with Resource Hacker. The comparison is outdated (because now Resource Hacker support x64) but there are a few interesting pros of using Anolis Resourcer (for example the support of PNG icons). Then regarding the .NET framework requirement, here my test results:
|
@felicienfrancois hmm yes, you're right. Especially this feature - "Intelligent Icon Merging" seems like the one we'd need here. Anyway, a whole .NET framework dependency for exchanging an icon seems to make the build step complexity one step higher :( |
@quasado
So it seems to be only a matter for some linux distribution which are on an more stable & security release policy (Red Hat, Centos, ..). Additionally, on those distribution which are mostly used on server, you'll have the issue of the X requirement for both ResHacker & Resourcer. We can assume that making things to work in such linux distribution is not trivial in any case. System admins are use to that :-) |
@felicienfrancois I've staged the changes (d412cd3) to replace rcedit with your node-winresourcer wrapper and it works pretty well. I am getting a warning message in the console when running from osx
Do you get the same message using your wrapper? In any case, it is still properly updating the exe with the ico resource info. I think this is our best option at the moment given that we don't have the licensing for bundling Resource Hacker and the current rcedit solution is not functioning properly while this issue has no response. |
@gabepaez |
I'm having some troubles building my app since the v0.1.2 release... |
Hi @bastimeyer,
|
Win7x64 (using MinGW though), nw v10.0.1, no problems without icon replacements... No matter which kind of icon I use, Resourcer seems to remove all the content of my app from the node-webkit executable after replacing the icon - the .exe file is ~2MiB smaller afterwards. I've tried both the CLI and GUI of Resourcer and all kinds of icon formats (< vista and >= vista, single icon and multiple icons). And as already mentioned above: all this doesn't happen while using linux and wine with the exact same configuration. I've also encountered a bug with the path format for the |
To determin if it's a winresourcer bug or a node-webkit-builder one, can you try to set the icon after the node-webkit-builder build (without icon set) using the winresourcer grunt task:
|
It's a Resourcer related issue...
This results in the following command line and running Resourcer with these parameters breaks my nw app... |
@bastimeyer Can you try it on the raw nw.exe (without the app in it). And if it succeed, try to build your app with the modified nw.exe. If it works, the fix in node-webkit-builder would be to set icon before packing. If it does not work, you can also try the following:
|
@felicienfrancois Changing the build order by replacing the icon before appending the app content to the exe file has finally fixed my problems. That was a great idea 👍 @gabepaez |
To replace the windows icon, rcedit simply doesn't work as it generates the wrong icon resource headers resulting in ugly window icons. Using Resource Hacker with command line
ResHacker.exe -modify "Project.exe", "Project.exe", "ProgramIcon.ico", ICONGROUP, MAINICON, 0
Works perfectly generating the correct icon header and results in high quality icons.
The text was updated successfully, but these errors were encountered: