# Inverted pictures?

What exactly does it mean when a picture is inverted? I picture is composed of RGB values, right? How can you invert those?

It means it’s turned upside down.

This is a trick question right?

No, I mean when the colors get weird. Say you have a value for blue, what do you do with that value to invert it?

I’m just guessing here but I imagine you would subtract its value from 255.
If the the 3 digit RGB blue value were 240, then its inverted value would be 15.
The RGB value for white is 255 255 255 and so its inverted value is 000 000 000.

I just wrote a 4th calculator for testing website colors. It is located at:
www.1728.com/colrchr4.htm

Unfortunately, it does not calculate inverted color values, but I think you might find the page quite useful.

I was thinking about it too, but I thought that couldn’t be the case. That would mean that some colors would be exactly the same after being inverted, but maybe that’s how it is.

Okay, and if you had an RGB value for blue, that would be
000 000 255 and its inverted value would be
255 255 000. (which is yellow).

No, I don’t think any colors would be the same inverted except for
RGB 128 128 128 (gray).

Is there a big demand to know the values for inverted colors? If so, it would be an easy matter for me to add another row with inverted values.

That is true, wolf_meister. Somehow I managed to think that 128 0 0 also would be the same, but I’m known to make stupid mistakes.

Mathematically, wolf_meister is right (to invert the color, subtract the color number(s) from 255). But think of it another way: using a color wheel, to invert a color, move across to the opposite side of the wheel.

(The color wheel img link was the best I could find; ignore the numbers outside the circle’s perimeter.)

The formula mentioned above, in which each of the three R,G,B components is independently subtracted from unity (or 255 in the scaled RGB that most people are familiar with) is the most common form of inversion and probably the one that most people think about.

Another way to look at it is this: a color K added to its inversion K’ will always sum to white. In a normalized linear component space, such as nonscaled computer RGB, this is done by subtracting the components from unity (since white is represented by unity in such a space). If the space is nonlinear, nonnormal, or not componentized (such as HLS or Lab), however, some other formula will be required since addition in a nonlinear space is more complex.

Moving to the opposite side of the color wheel is not an inversion; that’s a 180 degree rotation. To get the same result as an inversion requires a 180 degree rotation combined with a reflection across the 50% luminance plane.

KellyM
I thought the 3 types of color coding (HEX, RGB and Decimal) were sufficient.
http://www.1728.com/colrchr4.htm

It seems that other codings (CMYK, HSV, etc) are also used.
However, there seems to be no direct mathematical relationship to convert HEX, RGB and Decimal to any other system, correct?

Also, are inverted values used often enough that it would be worth showing the values on that web page?

Think of it as a color negative.
You have seen color negatives, have you not? :rolleyes:

springears
Yes, the way the OP was phrased was a bit confusing but I have seen the term “invert” used.
Open up MSPaint. In the image menu, one option is “invert colors”. Perhaps the OP should have used the term “inverted colors”.

You are confusing oranges with apples. HEX and Decimal are number bases (base 16, base 10) and RGB, CMYK, HSL, etc. are color systems (Red/Green/Blue, Cyan/Magenta/Yellow/blacK, Hue/Saturation/Lightness). RGB uses the values 0…255 decimal or 0…FF Hex (RGB 0,0,176 decimal is exactly the same color as 0,0,B0 Hex). Yes, there is a direct mathematical relationship between number bases. Some calculators (computer programmer-type) will convert between commonly used number bases like decimal, octal, hexadecimal and binary with a single button.

There is also a mathematical conversion between RGB and other color schemes like CMYK, although this gets a bit more complicated, for two reasons. One, not all color schemes encompass the same range of human-visible colors, and two, the diff schemes are designed for diff media and any conversion must take that into account.

Example: RGB is commonly used for display terminals that use light from screen phosphors. This is additive – white is (255,255,255). CMYK is used to put opaque inks on paper, and is subtractive – white is (0,0,0,0). In order to take into account the non-linearity of the human eye, phosphors, electrons, and ink pigments, a “color profile” is used for each device to translate from one system to the other. So it is impossible to say that RGB (255, 242,135) looks the same as CMYK (0,12,47,0), although that is what somes up on my particular image editor with the profile I have currently installed.

Image editors commonly do the conversion for you, so mathematics shouldn’t be a problem. It is recommended that you use the scheme most appropriate to the medium – for web pages, stick to RGB, for example.

Those encodings are just representations of the same coordinate system (scaled linear RGB). There are a multitude of other color coordinate systems out there, such as CIEXYZ, CMY, CMYK, HSV, HLS, Yuv, Luv, and Lab. Each of these systems has its own benefits and disadvantages.

There are, in fact, mathematical relationships between all of these color coordinate systems, although in some cases the relationships are quite complex. CIEXYZ, for example, is a linear transform of linear RGB. The difference from RGB and XYZ is that every perceivable color falls within the unit cube of the color space; this is not true in the case of RGB. HSV and HLS are both straightforward projections of linear RGB into cylindrical coordinates. Yuv, Luv, and Lab are more complicated spaces that are designed for greater perceptual uniformity than CIEXYZ or RGB; the conversions to Luv and Lab involve a cube root.

CMY and CMYK are negative spaces designed mainly for driving three-color and four-color printing devices. The “naive” conversion from RGB to CMYK is relatively straightforward, but generally doesn’t yield useful results. A proper conversion requires information about the performance of the printing device and the characteristics of the inks and paper to be used.

I have a colorspace explorer on my website that uses a colorspace called Lch[sub]ab[/sub] (a conical projection of Lab space), if you’re interested.

Musicat and KellyM
Thanks very much for those detailed answers.
KellyM - that webpage is very impressive.
Since I am only trying to demonstrate website colors, I guess I’ll just stick with HEX, RGB and decimal numbers. (If anything I might add an “invert” section on the www.1728.com/colrchr4.htm chart but that will be about it.)

GreyWanderer
I added another row of numbers to the color selctor and it now shows all 3 inverse values of the color that you input. Also, the text color changes to the inverse of the background color. Give it a try.
http://www.1728.com/colrchr4.htm

In case anyone is interested, I’ve written a new version of my color explorer. This one has a row for RGB inverses, displayed whenever they’re in gamut.

http://static.pyrzqxgl.org/~kmartin/colorexplorer2.html

KellyM
I’ve tried using that web page but it doesn’t seem to be working.

I discovered a few bugs in the code that only show up when using IE (I use Mozilla). I’d recommend the new version, which is at http://static.pyrzqxgl.org/~kmartin/colorexplorer.cgi.

This version is actually a collaborative color name database system – if you disagree with the name it gives for a particular color, you can recommend a different one.