I am creating a physical mosaic from a photograph, where each mosaic tile will correspond to a pixel of the (scaled down) original picture. The problem is: my tile color selection is limited, with the additional limitation of having a variable and even more limited number of tiles for each color. Hence, I need to stick to given color proportions.

for some reason I need to convert a picture to a 16-color palette. While the conversion itself is nothing special, I need the final result to stick to a well-defined color proportion. This means, for example, that I need the final picture to contain (e.g.) 15% of color #1 from the 16-color palette, 3% of color #2 and so on. How can I achieve this?


Unfortunately, this is not an out-of-the-box solution, but if you have got some programming skills (mostly, the code should be there already and you just need to know how to run or compile it), you might want to look at American Gothic in the palette of Mona Lisa: Rearrange the pixels from the colleagues over at Programming Puzzles & Code Golf.

Your question can be considered a special case of this challenge, instead of providing an "original" picture as the palette, you just can produce a dummy picture containing the right palette with the desired distribution of colours (e.g., if your image has 100 pixels, just create an image with 15 pixels of color #1, 3 pixels of color #2, and so on).

(Note: This only applies to the palette related aspect of the question, but does not address the scaling. There might be potentially different solutions if the scaling is already done with the palette restrictions in mind, but I haven't thought this through properly.)


Photoshop's lookup tables might be the tool that you're looking for, since you can arbitrarily assign input colors to output colors using them.

Another possibility is this: http://www.ximagic.com/q_index.html because you can specify a custom pallet for the output image.

  • 1
    I don't think either of these fills the fixed-proportion requirement. – mattdm Feb 15 '15 at 17:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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