Switch to full style
Post all Gimp scripts and script writing questions here
Post a reply

Python Plugin: Colourwheel Analysis

Sat Mar 12, 2016 7:04 am

I made a Python plugin that analyses the hue/saturation values used in an image and displays them on a colour wheel:

Image

Not as pretty as some of the other scripts here, but maybe of use to some. ;)

You can download the plugin from github where I also put up more detailed instructions.

Code-wise, I'm not completely happy with my little gimpfu import hack for the unit tests, but the proper way – putting the gimp-independent functions in a separate file – would have been more of a hassle for the users.

Re: Python Plugin: Colourwheel Analysis

Sat Mar 12, 2016 8:38 am

Hi Rebecca.

This is the only information (output color wheel) - is there any practical use?

Re: Python Plugin: Colourwheel Analysis

Sat Mar 12, 2016 11:37 am

Yes, that's the only information the plugin produces.

The idea is that you can "reverse engineer" existing pieces of art and see what colours were used in them. What colours to choose for your art (be it painting, digital art, photo, movie etc) is an important decision to make – you don't always want to use the full range of colours available, but rather limit your palette to achieve harmonic results or specific moods.

I'm currently reading "Color and Light" by James Gurney, who describes limited palettes and gives examples by placing geometrical masks called gamut masks on a colour wheel. He's also made a couple of blog posts about it. That's what inspired me to make this plugin so that I can inspect the colour wheel distribution of various things.

Of course, it doesn't really help you if you want to paint something from scratch, for that, you need to have something that limits your palette. MyPaint lets you set gamut masks on the colour wheel, and it has an export to GIMP palette option, but I paint in MyPaint anyway, so I haven't tried the export.

For example, to paint something like my example above with the yellow trees, I could use a mask like this:

Image

Quite interesting that a random snaphot I took turns out to have almost a perfect triangular gamut mask like right out of a textbook. ;) Your expample, too, has a very limited palette that's almost triangular.

Re: Python Plugin: Colourwheel Analysis

Sat Mar 12, 2016 11:56 am

I was wondering about the color wheel formula?
Like I wonder if it's good way of replacing colors like rotating colors...
Where you have your colors mapped to a position on a circle now...
What if you had 2 pictures...and then you'd replace one color at a time based on distance from center and angle so that you can replace one picture's color with another... I am just thinking out loud not sure how I would do it.

Re: Python Plugin: Colourwheel Analysis

Sat Mar 12, 2016 12:10 pm

The colour wheel is based on the hue, saturation, lightness (HSL) notation of colours, rather than RGB. Hue is the angle in the wheel, saturation is the distance from center (the most desaturated in the center, the most saturated on the out-most circle). Lightness (amount of white) is not displayed on the wheel.

GIMP has a couple of stuff under the "Color" menu that let you change those values on an existing image, like "Adjust Hue/Lightness/Saturation".

Re: Python Plugin: Colourwheel Analysis

Sat Mar 12, 2016 12:34 pm

Maybe i can use your script then
use rotate colors to do what i want.

Re: Python Plugin: Colourwheel Analysis

Sat Mar 12, 2016 12:40 pm

This is what i was thinking the plug-in could be used for. Fixing off color photos of the same subject. Say you take a picture of a person in a different lighting situation and want to create the same lighting in another photo of the same subject material. Just a thought. As we all well know different lighting types and shades create different colors from the same image.

Re: Python Plugin: Colourwheel Analysis

Sat Mar 12, 2016 8:09 pm


Rod wrote:This is what i was thinking the plug-in could be used for. Fixing off color photos of the same subject. Say you take a picture of a person in a different lighting situation and want to create the same lighting in another photo of the same subject material. Just a thought. As we all well know different lighting types and shades create different colors from the same image.


That is what I wrote my histogram match script to automate!

-Rob A>

Re: Python Plugin: Colourwheel Analysis

Sun Mar 13, 2016 1:47 am

Rob, thanks for recalling it.
It's really wonderful.
Here a quick (and not optimized example, only to show):
a) source image
DSCF1060_base.jpg
DSCF1060_base.jpg (145.38 KiB) Viewed 4570 times

b) image to modify
DSCF1339.JPG
DSCF1339.JPG (1.75 MiB) Viewed 4570 times


see in the next post what can be obtained...

Re: Python Plugin: Colourwheel Analysis

Sun Mar 13, 2016 1:51 am

using HSV
DSCF1339-HSV.JPG
DSCF1339-HSV.JPG (2.01 MiB) Viewed 4569 times


using LAB
DSCF1339-LAB.JPG
DSCF1339-LAB.JPG (2.14 MiB) Viewed 4569 times


note that this is an EXTREME test, done QUICKLY and without any further OPTIMIZATION.
Wonderful script !
Post a reply