Using GIMP in pixel art - Drawing, Working with the palette, Converting images to palettes, Saving the palette, Saving BMP.

Using GIMP in pixel art
 by Hippiman

After the article in ACNews #61 about converting graphics from RGB to palette
ATM Turbo and ZX Evolution (we will simply write “ATM palette”) 
via Photoshop, readers had questions about the same,
but in relation to GIMP. The process of converting graphics to GIMP
not much different from it in Photoshop, and make an article
only that would be uninteresting. Therefore, I decided to expand
topic and write a review article on the use of GIMP in pixel art.

                           Drawing

Tools (pencil, fill, etc.), I think, are not worth it
describe. Everything is the same in Photoshop. I'll just mention
aboutSelect by color tool - "selection by color"[something like
"magic wand" in Photoshop, if you uncheck it 
"neighboring pixels" - Ed.]. As the name suggests, he 
allows you to select all areas of the selected color in the image with
a certain tolerance -threshold. It's quite versatile
a tool that helps you find areas with the desired color
during conversion, and protect some areas from changes.

Here are a few reminders that will greatly speed up
work in GIMP:

  - Brush size can bechange using the hotkeys "[" and "]".
  - You can quickly swap the foreground and background colors
"X" key.
  - Quickly “take” a color from an image without the Eyedropper tool
you can simply hold down the "Control" key and click on the image
(if you have any of the drawing tools active).
  - Lines are drawn from the last drawn pixel by pressing
"Shift" keys.
  - Quick Zoom hangs on the number keys.
  - You can smoothly change the image scale by rotating the wheel
mouse with "Control" held down.
  - For quick navigation through an image that does not fit
on the screen, no need to use scroll bars. Clamp
middle mouse button and move the image in the desired direction.

This is basic, but it's better to memorize the hotkeys for the most common ones
the tools used. This way the work will go faster.

Another very important thing when working with pixel graphics
mesh You can display the grid via the menuView->Show Grid.
Usually, by default, the grid has a pitch of 10x10 pixels. Edit
step to a more suitable one - 8x8 or 16x16 - can be found in the menu
Image->Configure Grid. In the dialog box that opens, in addition to
grid step settings, there are many more interesting things: for example, color
grid lines - a very useful feature when working with dark
images.Working with the palette

Now let's move on to the most important thing. The palette can be found in the top
in the right corner of the screen, in theColourmap tab. It's better to get it right there
unhook it by pulling the tab's spine and make it a separate window.
Or attach it as a separate panel, without tabs. Otherwise when working
With layers you will have to constantly switch between tabs.
(Any floating window can be stuck back to some
panel by dragging it not by the window title, but by the spine
tabs.)

By double clicking on any of the colors you can open a dialog
color editing. After changing the color in the palette
The image will automatically change. All pixels with index
changed color will be repainted into a new one.

If you choose a color other than
palette, then when drawing, the pixels will be colored to the nearest
color from the palette.

If you paste an RGB image from the clipboard into a project with
palette, the RGB image will be automatically converted
to the current palette without anti-aliasing.

              Converting images to palettes

Converting a finished RGB image to a palette is very easy
simple. To do this you need to open the dialogIndexed Color
Conversion. MenuImage->Mode->Indexed. 

Let's go through the points of this dialogue.-"Generate optimum palette" - let the program itself
decide which colors will go into the palette. For the maximum
the number of colors in the final palette corresponds to the parameter"Maximum
number of colors".
 -"Use web-optimized palette" - as the name implies, when
by selecting this item the program will try to optimize
the final palette for the Internet [apparently the same as in Photoshop:
palette with components #00/#33/#66/#99/#cc/#ff - Ed.]. 
  -"Use black and white (1-bit) palette" - converts
image to a monochrome black and white palette.
  -"Use custom palette" - converts the image to
prepared palette.
  -"Remove unused colors from colormap" - determines whether to remove
or not, unused colors from the final palette.

The 1st and 4th points are most useful for us:"Generate optimum
palette" and"Use custom palette". I advise you to always keep 
hand-ready palette with ATM color card[corresponds
palette "Uniform" for 64 colors in Photoshop - Ed.]. 

Next comes a group of items responsible for blurring colors.
  -Color dithering - allows you to select the blurring method.
 -None - no blur. Colors are converted by approaching
the closest color in the palette.
  -Floyd-Steinberg (normal) and Floyd-Steinberg (reduce color
bleeding) - Floyd-Steinberg blur.
 -Positioned - fixed blur. Simpler than
Floyd - Steinberg, but at the same time more applicable in pixel
art'e.
  -Enable Dithering on transparency - whether to apply blur to
alpha channel.

To convert small images it is better to use
fixed blur or no blur at all.
Unfortunately, there are no additional blur options for
I couldn't find GIMP. The only option that can somehow 
brighten up the paucity of choice - paid module for Photoshop
"XiColorDither" with a 30-day trial period (in GIMP you can 
use modules from Photoshop using the PSPI add-on).
Anyway, automatic blur on small pictureslooks dirty. It's beautiful to convert some sprite without
It won't work with your hands even with XiColorDither. More or less
An acceptable picture is obtained from 320x200 and higher.

And now let’s talk about how you can use this dialogue to transform
any image to the ATM palette.

 1. Do the "Generate optimum palette". "Maximum number of
colours" is selected empirically depending on the image -
so that after this step the picture looks decent, but
the number of flowers was minimal. Usually it's about 60 - 70
flowers.
 2. We try to convert the image back to RGB, and then to
pre-prepared ATM palette via"Use custom palette".
At this stage, GIMP will bring all the colors in the image to the nearest
from the palette.
 3. If the picture has changed greatly in colors and is pure ATM
the palette does not suit, we roll back and try to adjust
distressed colors by hand.
 4. Let's look - if there are <= 16 colors, go to the manual stage
edits to the final image.
 5. If there are more than 16 colors, then we look for similar colors that can be
"merge together". For this I most often use the following
reception. I look at the image palette and look for similar colors,
after which, right in the palette, I change any of them to any
another, which is not in the picture (for example, poisonous pink).
(It would be nice if GIMP could automatically
highlight all pixels in the image with the current color from
palettes, but alas. There is no such function, you have to dance with
tambourine.) If there are few areas with this color, simply
I change this color to the neighboring one. As a result, the palette turns out
several identical colors.
 6. When there are no colors left that can be combined, you can
try to get rid of some color by combining two
others. Let's say there is an orange area in the image.
Then it can be replaced with a checkerboard pattern of red and yellow.
How to do it:
  - Another layer is created. A small one is drawn in this layer
fill pattern. For example, 4 pixels: 2 red and 2 yellow. This one
the example is copied to the clipboard, and then the layer is hidden.
  - Tool"Select by color"
select all areas in the image with the color we need.
  - Select the tool"Bucket fill tool" ("Fill").
 - BFill type(fill type) select "Pattern fill". Click on
lightened square with texture and in the drop-down list
select the upper left corner. This is our fill pattern.
  - Don't forget to select"Fill whole selection"
selection"), otherwise the filling will occur only in the area where
we clicked with the mouse.
  - Fill in the color we don’t need. Then we look at the result
and we correct it with our hands.
 7. After all these manipulations, the number of colors used
should be greatly reduced. To update the image palette,
convert it to RGB:Image->Mode->RGB. And then back to
palette:Image->Mode->Indexed, using the optimal
palettes.
 8. If there are still more than 16 colors, return to point 4.

As an option that can give a more pleasant result when
converting the image into your palette, you can suggest
first reduce the number of colors in it.
This is done like this:Colours->Posterise, and in the dialog that opens
specify the posterization level, after that we proceed in the same way,
as with the original image.It has been verified experimentally that
converting a 256 color image with sprites to 16 colors
ATM palettes through posterization with level 3 look much better
nicer than converting it to the same palette without
posterization.

                       Saving a palette

When drawing graphics for a game, you need to have them all in one
palette The easiest way to achieve this is by saving the finished palette
first image to file and subsequent drawing of new graphics
already in this palette.

This is done like this:

 1. Colors->Map->Set Colormap
 2. Click on the Default button, the Script-fu: palette window will open
selection.
 3. Scroll the list to the very top and find the current one there
image color map.
 4. Right-click on this color map. Choose
Duplicate palette.
 5. Rename the copy of the current color map to something
more understandable.
 6. That's it - now this palette will be available to everyone
images in all dialogs.

The palettes themselves are usually stored indirectories
C:Users%username%.gimp-2.8palettes.
This path can be changed in the menu
Edit->Preferences->Folders->Palettes.
The palette file is a regular text file that opens and
editable with a simple notepad. Here's some content
palettes:

GIMP Palette
Name: Colormap of Image #1
Columns: 8
#
255 0 0#0
210 3 16#1
 6 8 4#2
177 183 191#3
... 
208 97 145#255

If necessary, the palette can be completely prepared or
fix manually.

                         Saving BMP

After all the manipulations with the project, you will most likely want
get a readyBMP that can be used somewhere
more. In new versions of GIMP, it is not clear why, by simply saving
"Save"/"Save as" can only be saved in the native languageGIMP format
-XCF. To save to other formats you need to use
points"Export"/"Export as".

Next - very important!!! In the dialog"Export Image as BMP" you need 
expand"Compatibility options" and check the box
"Do not write color space information". Otherwise, a readyBMP may
is inadequately perceived by other software. For example, EvoSDK from
the palette cannot reach such images at all and perceives
them as black and white.

                             * * *

GIMP is a good free program that for most people 
tasks not related to professional photo processing,
Enough with your head. I tried to present the most necessary things.
Of course, this is not everything, GIMP’s capabilities are much wider,
than just drawing colored dots, but to get started with
Pixel graphics will be enough.

In the archive with the newspaper there is the same ATM palette with 64 colors, oh
which I mentioned above

Share your thoughts about the article