I have an image, it's the Backtrack_5_PitchBlack.jpg found at http://www.backtrack-linux.org/screenshots/, and I'd like to get it down to 640*480 for a Grub4DOS splash screen.
Unfortunately, this also means I need to index it to 14 colors (or less) and save it as an XPM image.

I get that I can crop the whitespace around the edges (so as to avoid needing to scale the image unevenly,) but will I get better results doing the indexing before, or after the scaling?

To summarize:
I need to -

  • Crop the image from 16:10 to 4:3
  • Scale the image so that it's 480px high
  • index the image to 14 colors

I'm using GIMP, what's the best order of operations here? I'm most likely going to use the Floyd-Steinburg (normal) dithering, but I also need to know what the best Scaling algorithm for this is. I'd prefer to have it look as if it were vectored straight into that size - edges as smooth as possible.


3 Answers 3


You'll want to scale first. Downsizing the image will compress your palette to some extent in and of itself. Indexing before hand would throw color away that may be helpful in the down-sampling step.

  • "throw color away that may be helpful in the down-sampling step" especially intermediate colors/tones which are useful for anti-aliasing.
    – horatio
    Apr 30, 2013 at 21:28

I would scale then Index - I can't think of a technical reason why, but.. If in doubt try it both ways, it won't take long and you can compare them both afterwards to see which best fits the purpose.


Scale, then index:

enter image description here

Index, then scale:

enter image description here

  • +1 for the screenshot. It really illustrated my suspicions. May 10, 2013 at 18:46
  1. First crop and scale (or scale and crop)
  2. then index to 14 colors.

For an extreme example, say we want to end up with a 2-color (blank and white) image that is 1/10 the size of some original image. If we were to index first, generating a big black and white image, then when we downscale 10:1, we end up with a grayscale image -- 10x10 regions with few black pixels would downscale to one light grey pixel; 10x10 regions with few white pixels would downscale to one dark grey pixel, etc. At best, we would end up with the same greyscale image that results from scaling the original image directly. At worst, if we index first, and then scale, smooth gradients might be smashed into white on one side, black on the other side, with a distracting and meaningless edge somewhere in the middle.

Either way, it would be better to scale first, and then index.

p.s. If you only have 14 colors available, sometimes the final image looks better if you manipulate the image a little to manually "flatten" gradients to 3, 2, or even 1 solid color, letting the indexer use fewer index slots on gradients, and more index slots on anti-aliased pixels.

  • Man, there are so many great answers here.. it's a nightmare choosing just one.. Upvote for you, however. :) May 2, 2013 at 17:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.