changing_application_icon_for_windows.rst 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. .. _doc_changing_application_icon_for_windows:
  2. Changing application icon for Windows
  3. =====================================
  4. By default, the exported project's icon will be the Godot icon.
  5. You will most likely want to change that for your project. There are two types
  6. of icons that can be changed on Windows: the file icon and the taskbar icon.
  7. Creating an ICO file
  8. --------------------
  9. Windows does not use formats such as png or jpg for application icons. Instead,
  10. it uses a Windows-only format called ICO. You can create your application icon
  11. in any program but you will have to convert it to an ICO file using a program such
  12. as GIMP.
  13. `This video tutorial <https://www.youtube.com/watch?v=uqV3UfM-n5Y>`_ goes over how to
  14. export an ICO file with GIMP.
  15. It is also possible to convert a PNG image to an hiDPI-friendly ICO file
  16. using this `ImageMagick <https://www.imagemagick.org/>`_ command:
  17. .. code-block:: none
  18. magick convert icon.png -define icon:auto-resize=256,128,64,48,32,16 icon.ico
  19. Depending on which version of ImageMagick you installed, you might need to leave out the ``magick`` and run this command instead:
  20. .. code-block:: none
  21. convert icon.png -define icon:auto-resize=256,128,64,48,32,16 icon.ico
  22. .. warning::
  23. For the ICO file to effectively replace the default Godot icon, it must
  24. contain *all* the sizes included in the default Godot icon: 16×16, 32×32,
  25. 48×48, 64×64, 128×128, 256×256. If the ICO file does not contain all the sizes,
  26. the default Godot icon will be kept for the sizes that weren't overridden.
  27. The above ImageMagick command takes this into account.
  28. Changing the taskbar icon
  29. -------------------------
  30. The taskbar icon is the icon that shows up on the taskbar when your project
  31. is running.
  32. .. image:: img/icon_taskbar_icon.png
  33. To change the taskbar icon, go to
  34. **Project > Project Settings > Application > Config**, make sure
  35. **Advanced Settings** are enabled to see the setting, then go to
  36. ``Windows Native Icon``. Click on the folder icon and select your ICO file.
  37. .. image:: img/icon_project_settings.webp
  38. This setting only changes the icon for your exported game on Windows.
  39. To set the icon for macOS, use ``Macos Native Icon``. And for any other platform,
  40. use the ``Icon`` setting.
  41. Changing the file icon
  42. ----------------------
  43. In Godot 3.5 and later, you can change the file icon without
  44. external tools using `godoticon <https://github.com/pkowal1982/godoticon>`__.
  45. Changing the file icon this way should work for executables containing
  46. an embedded PCK.
  47. .. warning::
  48. There are `known issues <https://github.com/godotengine/godot/issues/33466>`__
  49. when changing the application icon in executables that embed a PCK file.
  50. It's recommended to avoid using rcedit for now if you choose to enable the
  51. **Embed Pck** option for your Windows export preset in the Export dialog.
  52. The file icon is the icon of the executable that you click on to start
  53. the project.
  54. .. image:: img/icon_file_icon.png
  55. Before selecting it in the export options, you will need to install
  56. an extra tool called **rcedit**.
  57. You can download it `here <https://github.com/electron/rcedit/releases>`_.
  58. After downloading, you need to tell Godot the path to the rcedit executable
  59. on your computer.
  60. Go to **Editor > Editor Settings > Export > Windows**.
  61. Click on the folder icon for the **rcedit** entry.
  62. Navigate to and select the rcedit executable.
  63. .. note::
  64. Linux and macOS users will also need to install
  65. `WINE <https://www.winehq.org/>`_ to use rcedit.
  66. On macOS 10.15 (Catalina) or later, make sure to use a 64-bit version of
  67. both WINE and rcedit since 32-bit applications aren't supported anymore.
  68. .. image:: img/icon_rcedit.webp
  69. You should now have everything in place to change the file icon.
  70. To do that, you will need to specify the icon when exporting.
  71. Go to **Project > Export**. Assuming you have already created
  72. a Windows Desktop preset, select your icon in ICO format in
  73. the **Application > Icon** field.
  74. .. warning::
  75. All the supplied metadata must be valid. Most importantly, the version
  76. identifiers **must** take the form ``major.minor.patch.revision`` where
  77. every component is required and is a positive integer. For instance,
  78. ``1.2.0.0`` is valid but ``1.2.0`` is not.
  79. If you provide invalid metadata in the export preset, the application icon
  80. won't change as rcedit will fail to change the executable's metadata.
  81. .. image:: img/icon_export_settings.webp
  82. .. note::
  83. If rcedit fails to change the icon, you can instead
  84. :ref:`compile your own Windows export templates <doc_compiling_for_windows>`
  85. with the icon changed. To do so, replace
  86. `platform/windows/godot.ico <https://github.com/godotengine/godot/blob/master/platform/windows/godot.ico>`__
  87. with your own ICO file *before* compiling export templates.
  88. Once this is done, you can specify your export templates as custom export
  89. templates in your project's Windows export preset.
  90. Testing the result
  91. ------------------
  92. You can now export the project. If it worked correctly, you should see this:
  93. .. image:: img/icon_result.png
  94. .. note::
  95. If your icon isn't showing up properly, on Windows 10, try clearing the icon
  96. cache. To do so, open the **Run** dialog and enter ``ie4uinit.exe
  97. -ClearIconCache`` or ``ie4uinit.exe -show``.