Montag, 4. Juni 2018

Create an icon for an Eclipse e4 RCP application (Windows).

Trying to give your new Eclipse e4 application a new Windows icon is more complex than one might think.

The solution I am presenting here works for my application that is build with Tycho 1.0.0. I don't know if you run into the same problems when doing an export from Eclipse as I have never tried that.

When I tried to change the icon I ran into two different problems:

  1. Creating an Windows ICO file that contains all images in the correct formats.
  2. Adding the icon to the product definition.

Creating the Window ICO file

The Windows ICO file has to contain 7 images in different resolutions and depths:
  • 48x48, 8 bits
  • 32x32, 8 bits
  • 16x16, 8 bits
  • 48x48, 32 bits
  • 32x32, 32 bits
  • 16x16, 32 bits
  • 256x256, 32 bits
You can find many tools to create an ICO file for you. But you always have to export all your files in the right format and add them to the ICO file. I tried that with several tools and never got it working right.

So I went to Linux and just used ImageMagick convert to convert all my images into the format Eclipse needs and than use icoutils to create the ICO file.

Using GIMP I created four versions of the image I wanted to use as my icon: 256x256, 48x48, 32x32 and 16x16.

Then I just ran these commands and got my ICO file.

convert -colors 256 myicon_16x16.png tmp.gif
convert -colors 256 tmp.gif icon_16x16_8.png
convert -colors 256 myicon_32x32.png tmp.gif
convert -colors 256 tmp.gif icon_32x32_8.png
convert -colors 256 myicon_48x48.png tmp.gif
convert -colors 256 tmp.gif icon_48x48_8.png
icotool -c icon_16x16_8.png myicon_16x16.png icon_32x32_8.png myicon_32x32.png icon_48x48_8.png myicon_48x48.png myicon_256x256.png > icon.ico

Adding the icon to the product information

In the product definition of your Eclipse e4 application you can select an ICO file that should be used for the generated executable. When I clicked browse and selected the icon file I had previously generated I got this:



The IconExe tool that is used for replacing the icons during the Tycho buiold was not able to find the ICO file. I had to change that to a local path for it to work.


Keine Kommentare:

Kommentar veröffentlichen