Compile icon resources (‘GICN’)

The 'GICN' resource type is used for defining icon resources.
Icon resources are usually defined in a non-localizable GRC resource file (e.g. RFIX/ExampleFixGRC.grc)

API version 20 The possible source image formats of icon resources are PNG and SVG (previously you had to use BMP). When you use SVGs, then the SVG images will be converted to PNGs by the Resource Compiler, which in turn will become .ico files on Windows, and multi-representation TIFFs on OS X. Note that the filename of the SVG image must contain the default size at 1x resolution of the icon.

API version 20 To build HiDPI compatible native icons, use -w parameter of the ResConv Resource Compiler Tool.

For further info take a look at the following examples:

1. example

This example defines a single icon and doesn’t care about HiDPI display support.

  • Content of .\RFIX\ExampleGRC.grc:
    'GICN'  35000  "Wall icon" {
    }
  • Command used for compilation:

    On Windows:

    ResConv.exe -m r -t W -q utf8 1252 -p .\RFIX\Images -i .\RFIX\ExampleFixGRC.grc -o .\RO\ExampleFixGRC.rc2

    On Macintosh:

    ResConv -m r -t M -q utf8 utf16 -p ./RFIX/Images -i ./RFIX/ExampleFixGRC.grc -o ./RO/ExampleFixGRC.grc.ro

For this resource to compile successfully, either a PNG (35000.png) or an SVG (35000_<width>x<height>.svg) source image must be placed to the given images folder (.\RFIX\Images).

If both PNG and SVG images exist, then the PNG image will be used.

2. example

This example defines a single icon (with explicit filename) and converts it to a HiDPI compatible native icon.

  • Content of .\RFIX\ExampleGRC.grc:
    'GICN'  35000  "Wall icon" {
        "Wall"
    }
  • Command used for compilation:

    On Windows:

    ResConv.exe -m r -t W -q utf8 1252 -p .\RFIX\Images -i .\RFIX\ExampleFixGRC.grc -o .\RO\ExampleFixGRC.rc2 -w 2 3

    On Macintosh:

    ResConv -m r -t M -q utf8 utf16 -p ./RFIX/Images -i ./RFIX/ExampleFixGRC.grc -o ./RO/ExampleFixGRC.grc.ro -w 2 3

The last parameters in the command (-w 2 3) show that multiple representations of the icon will be converted into the compiled native resource (with 100%, 200% and 300% of the default resolution).

For this command to run successfully, an SVG (Wall_<width>x<height>.svg) source image or multiple PNGs (Wall.png, Wall@2x.png, Wall@3x.png) must be placed into the given images folder (./RFIX/Images).

If both the SVG and one of the PNG images exist, then the PNG will be used to create that specific representation of the icon.

For better understanding of the Graphisoft Resource Compiler, see a Windows example here or a Macintosh example here.