docs_image_guidelines.rst 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. .. _docs_image_guidelines:
  2. Creating Documentation Images
  3. =============================
  4. Throughout documentation images are often needed to make the explanation
  5. of a feature or concept as clear as possible for a reader. This page will
  6. explain the process from beginning to end.
  7. Capturing an image
  8. ------------------
  9. To take a picture of something in Godot a screen capture tool can be used.
  10. On Windows 10 and 11 that would be the Snip & Sketch program.
  11. Pressing :kbd:`Windows + Shift + S` lets you take a screenshot
  12. of a portion of the screen and save it to the clipboard.
  13. After pressing those keys, click and drag over
  14. the area you wish to take a picture of.
  15. On macOS, pressing :kbd:`Shift + Command + 3` does the same.
  16. To take a picture of the entire screen press :kbd:`Shift + Command + 4`.
  17. All screenshots taken will be saved to the desktop.
  18. Each Linux desktop environment has it's own screenshot tool. For example,
  19. on KDE Plasma the program Spectacle is used for taking screenshots. If your
  20. distribution doesn't come with one by default try searching its package
  21. repository, or Flathub if that's supported.
  22. All screenshots should ideally be taken on a 1080p screen. Anything higher
  23. resolution is adding detail that doesn't make the documentation better and
  24. dramatically increases file size. If you're taking screenshots on a higher
  25. resolution screen the screenshot should be scaled down. There are instructions
  26. on how to do this later on this page.
  27. Format conversion
  28. -----------------
  29. The current format for images in Godot's documentation is WebP (.webp). While some
  30. Linux programs will support saving screenshots in this format, macOS and the
  31. Snip & Sketch program on Windows do not. For images that don't need editing,
  32. such as precise cropping or adding outlines, Squoosh can be used.
  33. `Squoosh <https://squoosh.app/>`_ is a converter developed by Google, is open
  34. source, and doesn't give Google any image rights by using it.
  35. If you already have an image editor such as GIMP, Krita or Photoshop installed
  36. it may have the ability to open an image then save it as a WebP file.
  37. Cropping
  38. --------
  39. For a screenshot of a 2D or 3D scene in the editor the above steps will be enough.
  40. But for most UI images some extra work should be done, specifically cropping to
  41. make an image look clean. Below is an example of good cropping.
  42. .. image:: img/cropped_image.webp
  43. For cropping Krita is the recommended program. While some screenshot programs do
  44. have cropping built in it's not always easy to get something precise. And while
  45. Krita is designed as a painting program the cropping tool gives you pixel precision
  46. by default. Of course, feel free to use a different program you are familiar with.
  47. If you've never used Krita before download it from the `official Krita website <https://krita.org/en/download/krita-desktop/>`_,
  48. on Linux you may also be able to download it from your distributions repository,
  49. flathub is also an option. Once it's installed on your computer open Krita then
  50. open the image you want to crop. This button on the left panel is the crop tool.
  51. .. image:: img/crop_tool.webp
  52. After selecting it, click on the image, you should now have cropping tools available.
  53. .. image:: img/crop_edit.webp
  54. Click and drag the white boxes to adjust what gets cropped, if you zoom in close
  55. to the image you will see the individual pixels in an image, which is useful for
  56. precision.
  57. .. image:: img/crop_pixels.webp
  58. If you make a mistake and overcrop don't worry, cropping is non-destructive in
  59. Krita and can be adjusted. Click on the image with your cropping tool still selected
  60. and the controls will return.
  61. Scaling down an image
  62. ---------------------
  63. As explained earlier on this page, all images taken on a screen that is a higher resolution
  64. than 1080p should be scaled down. To do this in Krita click on **Image** on the top bar, and
  65. from the dropdown menu select **Scale Image To New Size**. This menu can also be opened by
  66. pressing :kbd: `ctrl + alt + I`. On this menu you want to adjust the pixel dimensions. For
  67. anything taken on a 4K monitor change the value of the width and height to half of its current
  68. value, for anything taken on a 1440p monitor multiply the width and height by .75. Make
  69. sure the **Constrain Proportions** box at the bottom of the menu is checked so you only have
  70. to change 1 value.
  71. Saving as WebP in Krita
  72. -----------------------
  73. To save an image as webp if it isn't already one, Go to **File > Save As**. Select **webp** from the
  74. **Save as type:** dropdown, then choose wherever you want to save it. After clicking **Save** a menu
  75. will popup with webp options. Make sure **Losses** is checked and **Quality** is set to 100%. This
  76. means the image will not lose detail and will be as small as possible.
  77. Outlines arrows and text
  78. ------------------------
  79. Sometimes an image needs something extra to properly direct the readers
  80. attention, or make something clear. Outlines and arrows can be used
  81. for this purpose. For these types of edits Inkscape is the recommended open
  82. source program, it can be downloaded from the `official Inkscape website <https://inkscape.org/release/inkscape-1.2.1/>`_.
  83. Like Krita, if you're on linux you can also check your distributions repository
  84. or get it from Flathub.
  85. A full tutorial on creating outlines is not provided here, we recommend searching
  86. for various tutorials on how to use it online. However there are two standards
  87. for doc image outlines and arrows. First, the color should be yellow, specifically
  88. this hex color: fffb44 (fffb44ff if there is a transparency value like in inkscape).
  89. This color was chosen specifically to make sure color blind people do not have
  90. issues reading the documentation, other colors can be used in addition to this yellow
  91. if multiple outlines on an image are needed, red should be avoided. The second standard
  92. is that all outlines and arrow lines should be 2 pixels wide.
  93. Finally, some images might require text to differentiate multiple parts of an image.
  94. There are no strict requirements other than use an easy to read non fancy font. As for
  95. color the yellow color from before should also be used, but black or other colors can
  96. be used if appropriate. For example, if yellow blends into the image, or if there are
  97. multiple outlines in multiple colors.
  98. Adding an image to a documentation page
  99. ---------------------------------------
  100. Once you've finished working on your image it can be added to the documentation.
  101. All images are stored in folders named `img`. To add your image add it to the img
  102. folder that's in the same folder as the rst file for the page. To add it in the
  103. text yourself you would type this `.. image:: img/documentation_image.webp` and
  104. `documentation_image.webp` would be whatever your image is named.