pkg icon indicating copy to clipboard operation
pkg copied to clipboard

Possibility to add a custom icon on the generated package

Open kennethpdev opened this issue 9 years ago • 38 comments

I think it would be good if it can also add a custom icon for the exe file. I'm not sure if thats possible already but would be a good feature.

kennethpdev avatar Jun 27 '17 11:06 kennethpdev

You can add resources (icon) to executables on Windows (ResourceHacker, etc) with pkg >4.0.

If you are asking about having a resource file that pkg can directly refer to it while building executable, may be @igorklopov can answer it.

sharathbaddam avatar Jun 29 '17 15:06 sharathbaddam

@sharathbaddam yes it should be while building the executable. I haven't tried ResourceHacker myself, but would love to try it. Thanks for your suggestion.

kennethpdev avatar Jun 29 '17 15:06 kennethpdev

Resource Hacker worked for me on pkg executables, however you have to make sure the ico you're using is a specific and valid size or the executable corrupts.

@sharathbaddam I don't understand the point you are making: since ResourceHacker is external to pkg and run after pkg has generated an executable, why would the version of pkg be important? why must it be > v4?

For osx: you can wrap the executable pkg makes in an app bundle like so and give it an icon that way. But if you're just scripting, it might be easier to just package the js itself like so...

tonywoode avatar Jul 08 '17 11:07 tonywoode

@tonywoode I was referring to this issue #91 when i said pkg > v4.

sharathbaddam avatar Jul 10 '17 19:07 sharathbaddam

thanks - yes my comments above about Resource Hacker should now be redundant then...great!

tonywoode avatar Jul 11 '17 07:07 tonywoode

Need help in setting the customized icon during packaging on windows using pkg.

I am packaging node service into exe using pkg (pkg package.json --output ./dist/test.exe) It sets the icon as nodejs icon. I also tried with pkg package.json --icon ./src/testIcon.ico --output ./dist/test.exe But still it sets the icon as default nodejs icon.

Can you please help in setting the customized icon while packaging using pkg.

I tried with ResourceHacker, it corrupts my exe.

soniagandhi avatar Mar 19 '18 15:03 soniagandhi

@soniagandhi please understand that to "overwrite" the current iconset, you need to prepare an "iconset.ico" with the same "dimensions" (otherwise you'll overwrite also part of the real executable, corrupting it).

Currently the default "iconset.ico" is composed by the following dimensions:

  • 16x16
  • 32x32
  • 48x48
  • 64x64
  • 128x128

If you create a new "iconset.ico"with different dimensions you corrupt the executable.

I used the following URL to create an "iconset.ico" with the correct dimensions.

After creating a correct "iconset.ico" I changed the icon using node-resourcehacker For example:

...
resourceHacker({
      operation: 'addoverwrite',
      input: 'PathToOriginalExe',
      output: 'PatToUpdatedExe',
      resource: 'PathToNew_iconset.ico',
      resourceType: 'ICONGROUP',
      resourceName: '1'
    },
    error => {
      ... callback to call when everything is done ...
    }
  );

I hope this can help you!

P.S. the ability to configure icon/details just using directly pkg would be very nice!

KingRial avatar Mar 27 '18 13:03 KingRial

This is possible if you edit the node base binary in .pkg-cache with ResourceHacker (not the executable) and then build your app again. You can also edit stuff like manufacturer, etc. (Version Info). The cache folder should be located in C:\Users\<username>\.pkg-cache\<version>\ be sure to edit the node binary, that you specified in --targets. This was initially discussed here.

FrankenApps avatar Oct 17 '20 10:10 FrankenApps

This issue is stale because it has been open 90 days with no activity. Remove the stale label or comment or this will be closed in 5 days. To ignore this issue entirely you can add the no-stale label

github-actions[bot] avatar May 10 '21 00:05 github-actions[bot]

This issue is now closed due to inactivity, you can of course reopen or reference this issue if you see fit.

github-actions[bot] avatar May 15 '21 00:05 github-actions[bot]

This is possible if you edit the node base binary in .pkg-cache with ResourceHacker (not the executable) and then build your app again. You can also edit stuff like manufacturer, etc. (Version Info). The cache folder should be located in C:\Users\<username>\.pkg-cache\<version>\ be sure to edit the node binary, that you specified in --targets. This was initially discussed here.

But the binary gets replaced as soon as you run the pkg command, since it downloads a new version of it. Thus reverting back to the green icon.

ExordiumX avatar Jun 17 '21 18:06 ExordiumX

I only managed to change the icon in recent versions using the Icon Maker - Icon Changer software. It seems there is a new 256x256 dimension which messed things

renandecarlo avatar Jul 30 '21 07:07 renandecarlo

I only managed to change the icon in recent versions using the Icon Maker - Icon Changer software. It seems there is a new 256x256 dimension which messed things

Hey, may I have the link of these softwares you are using? Thank you.

cayank avatar Aug 09 '21 13:08 cayank

It would be wonderful if we could just remove the Node icon. In most cases I think it's better not to have an icon than to have the Node icon

Alynva avatar Aug 27 '21 20:08 Alynva

I only managed to change the icon in recent versions using the Icon Maker - Icon Changer software. It seems there is a new 256x256 dimension which messed things

Hey, may I have the link of these softwares you are using? Thank you.

This one https://www.icon-maker.com/download.htm

renandecarlo avatar Aug 28 '21 01:08 renandecarlo

@soniagandhi please understand that to "overwrite" the current iconset, you need to prepare an "iconset.ico" with the same "dimensions" (otherwise you'll overwrite also part of the real executable, corrupting it).

Currently the default "iconset.ico" is composed by the following dimensions:

  • 16x16
  • 32x32
  • 48x48
  • 64x64
  • 128x128

If you create a new "iconset.ico"with different dimensions you corrupt the executable.

I used the following URL to create an "iconset.ico" with the correct dimensions.

After creating a correct "iconset.ico" I changed the icon using node-resourcehacker For example:

...
resourceHacker({
      operation: 'addoverwrite',
      input: 'PathToOriginalExe',
      output: 'PatToUpdatedExe',
      resource: 'PathToNew_iconset.ico',
      resourceType: 'ICONGROUP',
      resourceName: '1'
    },
    error => {
      ... callback to call when everything is done ...
    }
  );

I hope this can help you!

P.S. the ability to configure icon/details just using directly pkg would be very nice!

What do I put in input and output ?

onyx-nxt avatar Sep 30 '21 16:09 onyx-nxt

@soniagandhi please understand that to "overwrite" the current iconset, you need to prepare an "iconset.ico" with the same "dimensions" (otherwise you'll overwrite also part of the real executable, corrupting it). Currently the default "iconset.ico" is composed by the following dimensions:

  • 16x16
  • 32x32
  • 48x48
  • 64x64
  • 128x128

If you create a new "iconset.ico"with different dimensions you corrupt the executable. I used the following URL to create an "iconset.ico" with the correct dimensions. After creating a correct "iconset.ico" I changed the icon using node-resourcehacker For example:

...
resourceHacker({
      operation: 'addoverwrite',
      input: 'PathToOriginalExe',
      output: 'PatToUpdatedExe',
      resource: 'PathToNew_iconset.ico',
      resourceType: 'ICONGROUP',
      resourceName: '1'
    },
    error => {
      ... callback to call when everything is done ...
    }
  );

I hope this can help you! P.S. the ability to configure icon/details just using directly pkg would be very nice!

What do I put in input and output ?

You can put the path where you want to print.

Example, input -> Put the path to keep original exe "./original" output -> Updated exe file "./updated"

So you need to mkdir them first.

cayank avatar Sep 30 '21 16:09 cayank

ok thanks @cayank !

onyx-nxt avatar Sep 30 '21 16:09 onyx-nxt

ok thanks @cayank !

You're welcome.

cayank avatar Sep 30 '21 16:09 cayank

Hello @cayank, Using your method in changing the compiled pkg icon doesn't seem to work. :/

I2rys avatar Oct 25 '21 12:10 I2rys