INTRODUCTION
Some controllers have predefined palettes associated with them. The palette’s colors can not be altered. When converting images, it is desired to have the images use the controller’s predefined color palette. For example, a controller may have a grayscale palette of 16 colors. An image may use a palette of 16 grayscale colors, but the palette may define grayscale colors that are not the same as the controller’s palette. By using the GNU Image Manipulation Program, GIMP, images can be converted using a palette matching the grayscale colors of the controller. After converting the image to use this palette, it can be converted by the Graphics Resource Converter, GRC, to be used by Microchip’s Graphics Library.
DOWNLOADS
The following are helpful websites for downloaded the tools and firmware needed:
- GIMP 2.6 – GNU Image Manipulation Program (www.gimp.org)
- Graphics Library – This library is part of the Microchip Application Libraries (www.microchip.com/mla)
CONVERTING AN IMAGE
Follow these steps to convert an image to use a predefined color palette (for this example, the palette used has 16 grayscale colors):
- Open the GIMP application.
- Load the image. FILE->Open
- If the image is not a Bitmap, you will need to save it as one.
- FILE-Save as…
- Choose the Select File Type (By Extension)
- If the image is not a Bitmap, you will need to save it as one.
- Select Windows BMP Image
- Select Save
- Select Save under the Save as BMP dialog
- Select WINDOWS->Dockable Dialogs->Palettes
- The Palette Dialog will appear.
- In the Palette Dialog Select Import Palette. This can be done by a right click on any of the Palettes on the Palette Dialog.
- The Import Palette Dialog will appear.
- Select the Palette file radio button.
- Select the palette file .gpl (For example: Grayscale-Palette-4bpp.gpl) (see image in Step 4).
- Select the Import button.
- The palette, Grayscale-Palette-4bpp, will show up in the Palette Dialog.
- Select IMAGE->Mode->Indexed…
- In the Indexed Color Conversion dialog, select the Use custom palette radio button
- Type the name of the palette.
- IMPORTANT: Make sure that the "Remove unused color from colormap" is unchecked.
- Select Convert
- The image will now be converted using a 16 grayscale color palette.
- Save the image as a Bitmap.
This image can now be converted by the GRC for use with the Microchip Graphics Library.
Here is an example of a palette file *.gpl (Grayscale-Palette-4bpp.gpl)
GIMP Palette
Name: Greyscale Palette 4bpp
Columns: 0
#
0 0 0 BLACK
17 17 17 Untitled
34 34 34 Untitled
51 51 51 Untitled
68 68 68 Untitled
85 85 85 Untitled
102 102 102 Untitled
119 119 119 Untitled
136 136 136 Untitled
153 153 153 Untitled
170 170 170 Untitled
187 187 187 Untitled
204 204 204 Untitled
221 221 221 Untitled
238 238 238 Untitled
255 255 255 WHITE