Manually entering 16 bit color values in GIMP

1

I am trying to create some images in GIMP to provide black level masks for projector blending. This requires the geometry to include a very dark grey color that needs to match an extant color in the world that I can't control. I have mostly figured out the program, but I'm having a problem controlling the color.

The foreground color selector in 0..255 mode only allows me to enter a precision down to 0.1 for each of R, G, and B. With RGB values of .1/.2/.2, my grey comes out too bright, and with RGB values of .1/.1/.2 it comes out too dark. I am using 16 bit integer precision, so I know that the program and file are capable of storing values in between these, but I need to know how to manually enter such intermediate colors. Is there another way to select a color between those two, and if so how would I do it?

Here is a screenshot of the dialogue in question: the foreground color selector in GIMP

I'm using version 2.10.8 on windows for what that's worth.

I've done a fair amount of internet research, and so far this thread is the only thing I've found that adresses the same problem and it doesn't seem to include an answer https://discuss.pixls.us/t/gimp-color-picker-values/5571

Ethan48

Posted 2019-03-04T13:46:49.597

Reputation: 113

Answers

1

It is not possible to set such a color in GIMP 2.10.

I've just checked it out - although the image precision per se can be far higher than 8 bit, solid colors as set in GIMP context are only used with an 8 bit precision (that is: 256 levels of each color).

Here is what I[ ve done: My first attempt was setting the foreground color programmatically by using the Python console. While the call to pdb.gimp_context_set_foreground can take a triple of floating point numbers, from 0 to 1, if the number is less than 1/256.0, it is rounded to zero.

Then I tried to create the color (1 / 512, 0, 0) on the image itself - which the color picker indicated I succeeded in doing (this will be your way out, so just keep reading), then use the color-picker to add this color as foreground color. On using the color picked in this way to fill an area, again, GIMP had rounded the color down to (0, 0, 0).

So, forgetting about setting the FG color, the way to create a surface with a precision smaller than 1/256 in any component in GIMP 2.10 is using the painting or color tools.

You can do this, and use the color-picker tool to check for success:

  1. use at least 16bit precision
  2. fill an image with black;
  3. Set your foreground color to the lowest possible graylevel (010101 hex color on the color dialog)
  4. use, for example, the bucket-fill tool and set the opacity to desired level (25% for 1/4 of 1/256 gray, (1/1024 gray)).
  5. Use the color picker tool to check if you got to the desired level (1/1024 gray will show 0.000076 for each component - while the 8 bit gray #010101 is 0.000304 for each component).
  6. Convert the image to "16 bit integer precision" back before exporting to .PNG file - I further tested and found out that attempts to save a 32bit FP precision image as a PNG file will result in an 8bit png file (all work above is lost). But if the image on GIMP is 16bit integer, then the PNG export generates a correct 16bit PNG. (Saving as native .xcf file format will preserve the precision, of course)

Some extra notes:

so, if 16bit suffice you, you can use 16bit integer all way along, that way it is easier to check the values under the color picker.

On my initial test, instead of a 25% opacity bucket-fill, I used the Color->Curves tool to reduce the gray level bellow 1/256 - I just filled the image with #010101 gray, clicked to use the curves tool, and dragged the right-handle to midpoint, thus halving all pixel colors on the image. Using the curves tools may be more confortable to you: just paint your images with low gray levels as you would if you would not need the extra levels, and then use this technique to reduce all existing gray levels at once as needed.

jsbueno

Posted 2019-03-04T13:46:49.597

Reputation: 695

1I just tested this and it totally solves the problem - thank you! One refinement for anyone who sees this in the future - the same idea of modulating using the opacity works on the layer that the solid is drawn on if it's isolated. This just saves the trouble of adjusting the geometry for the outline differences between bucket fill and 'fill path.' – Ethan48 – 2019-03-05T14:47:42.793