Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to turn an RGB image into indexed mode specifying number of colors and...
#1
Hello GIMP gurus,


Is there a way to turn an image into indexed color mode with a custom palette while specifying a number of colors as well?

I want to say turn a full RGB image into let's say 8 colors (indexed) but not generate optimum palette but 8 colors from my palette of colors.

Quote:Currently,
the Cross-stitch turns image into indexed colors (number of colors specified by user).
Then it replaces each indexed color by a closest match DMC thread color.
This process isn't the optimal, since turning to indexed colors already does some conversion and then matching DMC colors does some more conversion to it's 2 conversions which could take us further from original.

I was thinking of using the indexed colors where you specify a palette which I could make that already contain the DMC thread colors. So that it's one conversion so it's better. But now the problem is GIMP doesn't allow you to specify number of colors when you specify a custom pallete.

Any ideas on how I could do this? reducing number of colors while using a custom palette?
Reply
#2
Not too sure that imposing a limited palette will work. How do you decide on the colours and match to an image.

However, throwing one into the hat.

1. You can take your defined colours from a palette and paint onto a canvas in RGB https://i.imgur.com/iMjZCvw.jpg
2. Then that will convert to indexed (with whatever number of colours) to give a colormap of the defined colors.
3. Anything that goes into that indexed image assumes the properties both indexed and colormap. https://i.imgur.com/ibloavC.jpg

but no guarantee that; a) they are a good match in the image b) all the colours are used.
Reply
#3
Thanks for your effort Rich!
Reply
#4
Image>Mode>Indexed and provide a palette:

   
Reply
#5
the spec was ..as I read it..

Quote:.. but 8 colors from my palette of colors.

so you still have to create a new palette with just 8 colors
Reply
#6
rich, you're right I want to also specify number of colors to use from palette.
Reply
#7
Now that I see the actual problem.... However, "this process isn't the optimal" is an assertion that requires proof. It could well be the optimal, if not for the colors, then for the processing time. A way to check this is to bluntly try all combinations of eight DMC colors, compute a "distance" of the results to the initial image, and see which one give you the smallest distance(*). If you find a result which is noticeably better than the indexing then you can invest time trying to find a better algorithm. But optimizing colors when the color balance of the initial image is possibly already overloading the WTF meter and the threads will quickly change color due to UV light (or dirt) could be seen by some as being futile.

(*) But be ready to acquire some Bitcoin-mining gear to speed this up, and you may have to come with the proper "distance" function.
Reply


Forum Jump: