Wednesday, July 11, 2007

GIMP palettes

Yesterday I talked with my studio manager about the GIMP's capabilities of working with palettes. We both agreed that if one creates an indexed bitmap, its palette can only be expanded (new colors can be added), but cannot be reduced (existing colors can't be removed from the palette). I had some bitmaps to edit and stumbled upon the same problem - I needed to delete a color from an existing palette. So, after fighting with the GIMP menus for 15 minutes I found my way to victory :) .

Here it is:
  • Start GIMP (it's obvious, but I'm trying to be exhaustive :) )
  • Open an existing bitmap (an indexed one, if it is RGB image, convert it to an indexed image: "Image" -> "Mode" -> "Indexed...")
  • Now open the palettes dialog ("Dialogs" -> "Palettes", or CTRL+P)
  • Right-click over one of the existing palettes, and choose "Import Palette...", and from the "Select Source" choose the "Image" radiobutton. This will create a new palette from the existing image. It is important to remember the name of this new palette, for now we can use the name "TEST" and click on the "Import" button
  • Find our new palette called "TEST" in the existing palettes list and double-click on it's icon (or use right-click and "Edit Palette...") to show the Palette Editor
  • In Palette Editor we can finally choose a color to delete - just right-click over the selected color and choose "Delete Color", or use the recycle bin icon at editor's bottom
  • We ex-terminated some colors and the palette cries for saving. This can be done with the "Save" icon again at editor's bottom
  • After closing the Palette Editor we show again our tortured image and convert it to a RGB image with "Image" -> "Mode" -> "RGB", and again to an indexed image with "Image" -> "Mode" -> "Indexed..." to be able to assign new palette (in this case it is "TEST" palette)
  • Look at the "Indexed Color Conversion" dialog, locate "Colormap" section and then choose the "Use custom palette" radiobutton, then click on the palette icon and locate our "TEST" palette to select it. It will be usefull if the checkbox "Remove unused colors from final palette" is checked, and for our case the color dithering can be set to "None", because our image has been already an indexed one. "Finish Him!" with click on "OK" button...
  • Just to be sure that we really messed-up our image's palette, open "Dialogs" -> "Colormap" and look at the palette. Good work, soldier!
I hope you really hate GIMP now, and if you don't - go see a doctor... Otherwise, if you make this exersize several times you will be able to do whatever you want with you indexed images.

There is one drawback actually, and I don't know already why it is happening - when importing back a palette, the palette is reordered and the image is reindexed to use the new colors' indices. There is no change of the image's look, but this strange effect can broke our nerves if several bitmaps share a common palette. I hope to find a way to avoid this color reordering...

Tuesday, July 10, 2007

Scream from a newborn...

Here we go - I followed a friend of mine (http://python-a-day.blogspot.com) and just created a blog. It will be a good test to see whether I'm too lazy to do something regularly except going to work and telling jokes about Micro$oft :)