changing_application_icon_for_windows.rst 5.7 KB

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