Q: How to extract a color palette from bitmap image using Blender 3D?

Hello folks!

I was surfing the web and found this website which shows color palettes extracted from movie frames:

http://moviesincolor.com/page/2So

I was wondering if it’s possible to build a tool in Blender 3d able to do that :slight_smile:

Do you think that the node system can be used to achieve such results? What are your thoughts on that matter?

Greetings!

Ortiz

I took a look at some color extractors source codes, and the general techniques, as I thought, is to find which colors are appearing the most often in the image by looking at each pixel. I believe that the only way to do that in Blender would be through Python, as the node system doesn’t seem fit for such a task. You can find some python scripts on github, though you will need to dowload some more modules to handle image processing in python.

@KWD you could build it by using heavy use of the normalize node with crazy math… but yeh it would be far simpler and easier to do it via scripting language… whether you use blender for its python libraries / image loading or whether use python/another programming language to do it is another debate… but pretty much the easiest way to do it is outside of blender.

Hello KWD and doublebishop!

Thank you very much for your feedback.

Indeed… Using only the node system will be more difficult, if not impossible. My hope was to make something interactive. :slight_smile: I hope I can elaborate a template in the future.

Yours,

Ortiz

In Photoshop Elements (and GIMP) you can go to Image:Mode:Indexed Color and set the number of colors you want to reduce the image to. In P.E., you can then open the Color Map and see what those colors are. I’m not sure how to view the color palette in GIMP (or even if it’s possible.)

Steve S

Not sure that the OP example is representative of whole movie or even the frames shown, as colour is weighted by cognitive bias. I see more reds against blues as they are culturally more dominant for me. I guess you could reduce the colours in the image then sample the results?

It would be nice to have an actual colour palette defined in Blender, not just an import from GIMP.

Hi there Steve S and 3pointEdit! Good ideia, GIMP is nice for this task. A batch script could be a nice start :slight_smile:

  1. Original


  2. Indexed to 8 colors


  3. Back to RGB

  4. Pixelize filter


Python PIL (or Pillow ) can be easily used as a module for blender addon/script. Here is a short recipe to index colors in source image.

Thank you so much for the resources 3point and eppo. I hope I can handle the technical information behind them :slight_smile:

See you later!

Ortiz