# Re: [Gimp-developer] Three questions about opening an image and converting it to linear light RGB

• From: Nicolas Robidoux <nicolas robidoux gmail com>
• To: Gez <listas ohweb com ar>
• Cc: gimp-developer <gimp-developer-list gnome org>
• Subject: Re: [Gimp-developer] Three questions about opening an image and converting it to linear light RGB
• Date: Sat, 5 Apr 2014 08:45:54 +0200

```I'm getting questions about negative light values and "values larger than
255" and why one would not clip them at every step of a chain of operations
even if the initial input image and final output images are both (say) sRGB.

(Maybe putting quotes around "gamut" was not quite enough to be clear.)

Here are some links that kind of answer the question, right off the top of

http://entropymine.com/imageworsener/clamp-int/

http://www.imagemagick.org/discourse-server/viewtopic.php?f=22&t=22287

As soon as you do operations such as unsharp-mask, you produce "blacker
than black" (negative, say) and "whiter than white" (larger than the upper
bound of your color cube, if your color space is a represented by a cube of
values, ignoring transparency and CMYK issues for simplicity). Unless your
colorspace is large enough (unbounded, say) to fit those "unnatural"
colors, you need to decide what to do with them at every step.

Another simplistic example: Suppose you are "rotating" colors (in the sense
of performing a rotation of the color values around some anchor color
understood as points in 3D space). If you clamp at every step, this
operations is not reversible, because the pieces of the cube that stick out
after the rotation are lost forever. If you don't clamp, this operation is
reversible.

My simplistic example suggests that if you want to modify an image using
"untransformed" color coordinates losing as little information as possible,
you don't want to clamp.

My point: Clamping at every step demonstrably makes things worse, at least
some of the time.

Metaphor: imaginary numbers were initially seen as "artificial" means to
solving equations in which only "real" numbers appeared: They were not part
of the statement of the problem, and they did not appear explicitly in the
final answer. People only wanted the "real" solutions to the problem.
(Because they're real!)

If, however, you go "The problem is real and the solution is real, so
everything in between must be real" and start ignoring the imaginary parts
of the real numbers at every step, you'll get the wrong answer quite often.

Conclusion: It's not because colors are not found in the initial image and
cannot be displayed in the output that they should be discarded at every
step.

-----

I wrote more than I wanted. Hopefully I've made things clearer.
```

• Follow-Ups:
• References: