<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.0.12-alpha" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>

<channel>
	<title>Jeffrey Friedl's Blog</title>
	<link>http://regex.info/blog</link>
	<description>Not a photo blog, but sometimes I play one on TV</description>
	<pubDate>Thu, 04 Dec 2008 14:35:33 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.0.12-alpha</generator>
	<language>en</language>
			<item>
		<title>Digital-Image Color Spaces, Page 1: Introduction</title>
		<link>http://regex.info/blog/photo-tech/color-spaces-page1/</link>
		<comments>http://regex.info/blog/photo-tech/color-spaces-page1/#comments</comments>
		<pubDate>Tue, 03 Oct 2006 08:45:30 +0000</pubDate>
		<dc:creator>Jeffrey Friedl</dc:creator>
		
		<category>General</category>

		<guid isPermaLink="false">http://regex.info/blog/photo-tech/color-spaces-page1/</guid>
		<description><![CDATA[

 

Article:
Table of Contents &#160; &#160; &#160; Page:
1 &#183;
2 &#183;
3 &#183;
4 &#183;
5 &#183;
6 &#183;
7
&#160;&#160;&#160;&#160;&#160;&#160;This is the first page of a seven-page article


<br style='display:block;margin:5px'/>Prolog
<br style='display:block;margin:5px'/>

There are multiple ways to interpret a number as a speed: &#8220;65&#8221;
in miles/hour is highway cruising speed, but &#8220;65&#8221; in knots is a
speeding ticket, while &#8220;65&#8221; in kilometers/hour is only half
that speed. &#8220;65&#8221; in meters/second is a category-4 hurricane,
and &#8220;65&#8221; in Mach is faster than a meteor.

<br style='display:block;margin:5px'/>

Clearly, when discussing speed, it's important to know not only the raw
number, but also the scale to apply to it.


<br style='display:block;margin:5px'/>Introduction
<br style='display:block;margin:5px'/>

When it comes to representing color, the digital-image version [...]]]></description>
			<content:encoded><![CDATA[

<style type='text/css'>
a.btn    { background-color: #555; border: solid 1px #888; padding: 2px 5px }
span.now { background-color: #533; border: solid 1px #888; padding: 2px 5px; font-weight: bold }
</style>
<div style='display: block; background-color: #444; padding: 7px; border: solid 2px gray'>
<b>Article:</b>
<a class='btn' href='http://regex.info/blog/photo-tech/color-spaces-page0/'>Table of Contents</a> &nbsp; &nbsp; &nbsp; <b>Page:</b>
<span class='now'>1</span> &middot;
<a title='Test Images'               class='btn' href='http://regex.info/blog/photo-tech/color-spaces-page2/'>2</a> &middot;
<a title='Color Mis-Management'      class='btn' href='http://regex.info/blog/photo-tech/color-spaces-page3/'>3</a> &middot;
<a title='Color Mangement'           class='btn' href='http://regex.info/blog/photo-tech/color-spaces-page4/'>4</a> &middot;
<a title='Chromaticity Diagrams'     class='btn' href='http://regex.info/blog/photo-tech/color-spaces-page5/'>5</a> &middot;
<a title='Design Tradeoffs'          class='btn' href='http://regex.info/blog/photo-tech/color-spaces-page6/'>6</a> &middot;
<a title='Recommendations and Links' class='btn' href='http://regex.info/blog/photo-tech/color-spaces-page7/'>7</a>
<small>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;This is the first page of a seven-page article</small>
</div>

<p><a name='Prolog'><b>Prolog</b></a></p>
<p>

There are multiple ways to interpret a number as a speed: &#8220;65&#8221;
in miles/hour is highway cruising speed, but &#8220;65&#8221; in knots is a
speeding ticket, while &#8220;65&#8221; in kilometers/hour is only half
that speed. &#8220;65&#8221; in meters/second is a category-4 hurricane,
and &#8220;65&#8221; in Mach is faster than a meteor.

</p><p>

Clearly, when discussing speed, it's important to know not only the raw
number, but also the scale to apply to it.

</p>
<p><a name='Introduction'><b>Introduction</b></a></p>
<p>

When it comes to representing color, the digital-image version of this kind
of scale is its <b>color space</b>. A digital-image file is made up of raw
numeric data &mdash; data that is not &#8220;color,&#8221; but numbers
representing color. There are actually many different ways to represent color with
numbers in an image file; if an application processing an image file
doesn't know <i>which</i> scale was used in creating the image's raw
numeric color data (and if it isn't able to guess correctly), it doesn't
know how to properly recreate the color when printing or displaying the
image. The result is an image with wrong colors, like a TV whose
&#8220;tint&#8221; setting is way out of wack.

</p>

<p><a name='Example'>Here's an example (me and my son, neither of whom are supposed to be green!):</a></p>

<table cellpadding='10' style='margin-top:10px; margin-bottom: 20px; border: solid gray 2px; padding:20px'><tr>
  <td align='center'><img src="http://regex.info/i/cs/sample-okay.jpg" width="330" height="221" alt='image whose color space is recognized and understood'/><p><b>Color Data Properly Interpreted</b></p></td>

<td align='center'><img src="http://regex.info/i/cs/sample-wonky.jpg" width="330" height="221" alt='image created with a crazy color space, but without an embedded color pfoile, so it looks wonky'/><p><b>Color Data Misinterpreted</b></p></td>
</tr>

</table>

<p>

So, a color space is a set of parameters that describe how to convert
between numbers and real-world colors. Different color spaces mean
different conversions: different real-world colors from the same number, or
different numbers from the same real-world color. The technical details are
discussed later in the article; for the moment, just consider them
abstractly.

</p>


<p><a name='FileFormats'><b>File Formats are an Unrelated Topic</b></a></p>
<p>

To be clear, the concept of a <b>color space</b> is different from a
<b>file format</b>. Many image file formats (such as JPEG, TIFF, DNG, etc.)
have the ability to use different color spaces &mdash; different ways to
encode the image color &mdash; for their raw numeric data. You can think of
a file format as being a standard for how to arrange image data
(&#8220;such-and-such metadata is allowed, the image is composed of lines
of pixels arranged this-and-that way, using such-and-such compression and
interleaving....&#8221;) and a color space describes how to interpret the
per-pixel data into light.

</p><p>

<a name='soundspace'>Using music files as an analogy, the &#8220;sound
space&#8221; would be a</a> set of parameters such as the minimum and
maximum frequency that can be encoded, the range of amplitudes (volume)
that can be encoded, and the mathematical parameters for how the smooth
range of encodable real-world frequencies and amplitudes are converted to
discrete, raw numeric data.

</p>


<p><a name='sRGB'><b>Color-Space Basics: &#8220;sRGB&#8221;</b></a></p>

<p>

The most commonly-used color space is called &#8220;sRGB,&#8221; which has
one overwhelmingly important characteristic: <i>it's the most commonly-used
color space</i>. Just about every scanner and digital camera can produce
images with sRGB-encoded color. Just about every image-handling device
(like printer) and color-aware application (photo editor) can handle images
with sRGB-encoded color. In fact, it's the de facto default color space for
image input and output of most devices and applications (at least those
that understand color spaces). It's the official default color space for
the World Wide Web.

</p><p>

The ubiquity of the sRGB color space is really quite convenient.

</p><p>

Because things that produce images <font color='gray'>(digital cameras,
scanners, image-editing software, ....)</font> are on the same color-space
wavelength, so to speak, as many things that process or display images
<font color='gray'>(printers, image-viewing software, ...)</font>, colors
are generally encoded and decoded reasonably well. What you see is not only
what you get, but what you're <i>supposed</i> to get.

</p><p>

So, in the face of this overwhelming ubiquity, why would anyone even bother
using a different color space for a digital image? (That is, a different
method to encode colors with numbers within the raw image data?)

</p>

<p><a name='Tradeoffs'><b>Color-Space Tradeoffs</b></a></p>

<p>

For technical reasons discussed later in this article, the design of a
color space necessarily involves tradeoffs among various aspects of image
quality. For example, it might be surprising to learn that it's impossible
for a color space to represent all the colors that a human eye can discern,
and so some subtle shades must necessarily be omitted (if an image's true
color is one of the omitted shades, the encoded color becomes one that's
close &mdash; usually very, very close &mdash; to the true color). So,
<i>which</i> shades are included and excluded is one aspect that makes a
color space more or less appealing to certain users or artistic tastes.

</p><p>

The <a href='http://regex.info/blog/photo-tech/color-spaces-page2/'>next page of
this article</a> offers a few more technical details about color spaces and
their relative merits, but the main point of this article is merely to
introduce the concept of color spaces &mdash; ways to convert colors to and from
raw numeric data &mdash; and why it's important for the photographer to know
about them.

</p>
<p><a name='Profiles'><b>Color Profiles</b></a></p>
<p>

When a different color space is used to encode the raw image data, the
resulting data is still just a bunch of raw numbers, so how does a printer
or application know that it should consider it in the light of something
other than sRGB (or whatever its default color space is)? The answer is
usually found in the form of an embedded color profile.

</p><p>

A <b>color profile</b> for a color space is the aforementioned set of
parameters that describe the color space, arranged in a standardized way so
that they can be communicated along with an image. It can be embedded
within a digital image file as metadata, along the same lines as how the
date and time are included with the image. This conveniently allows a
printer, image-display software, or other color-aware device/application
that receives the image file to know the particulars of the color space so
that it can properly decode the colors. (If an image doesn't have an
embedded color profile, most devices go ahead and decode the colors using
the parameters of the sRGB color-space.)

</p><p>

Without the proper color profile associated with the color space used to
create the image data, applications don't know how to decode the color
data. This results in mixed up or &#8220;off&#8221; colors, like the
&#8220;color data misinterpreted&#8221; image shown above. That example, by
the way, is not a simulation, but an image that looks perfectly normal when
interpreted using the proper color space. To ensure that you'd see the
wrong colors, I manually removed the embedded color profile from the image
file, knowing that your browser would then misinterpret the color data.

</p>
<p><a name='Test'><b>Color Profiles Don't Always Get The Respect They Deserve</b></a></p>
<p>

You might be surprised to find out what happens when I do go ahead and
include the proper color profile along with the image, as I do with the
middle image here:</p>

<table cellpadding='5' style='margin-top: 10px; margin-bottom: 20px; border: solid gray 1px; padding: 10px 10px 0 10px'><tr valign='top'>

<td  valign='middle' style='background-color:#CFC' align='center' width='230'><img noindex src="http://regex.info/i/cs/sample-okay.jpg" width="100" height="67" alt='image whose color space is recognized and understood'/><br/><b>Correct</b></td>

<td  valign='middle' style='border: solid 3px black' align='center' width='230'><img noindex src="http://regex.info/i/cs/sample-wonky.profile.jpg" width="220" height="147" alt='image with crazy color space, and an embedded color
profile to match'/><br/><b>Correct or Wrong?</b></td>

<td valign='middle' style='background-color:#FAA' align='center' width='230'><img noindex src="http://regex.info/i/cs/sample-wonky.jpg" width="100" height="67" alt='image created with a crazy color space, but without an embedded color
pfoile, so it looks wonky'/><br/><b>Wrong</b></td>

</tr>

<tr><td colspan='3'><small>(For your reference, here is the <a
href='MySuperFunkyRGB.icc'>color profile</a> for the color space used for
the center and right-side images.)</small></td></tr>

</table>


<p>Does the middle image look okay or wrong? It depends on how
colormetrically-enlightened your browser is:</p>

<ul>
  <li><p><b>Middle Image Looks Okay:</b> your browser recognizes and respects an image's embedded color profile. Congratulations!</p></li>

  <li><p><b>Middle Image Looks Wrong:</b> your browser does not recognize
       or respect an image's embedded color profile. How unsociable!</p></li>

</ul>

<p>And herein lies the problem: <b>most browsers are not &#8220;color
managed&#8221;</b> applications, meaning that they do not know how to
recognize or understand color profiles.</p>

<p>We'll talk much more about color management later, but first let's look
at just how wrong the colors can be in a real-world situation. When
creating the sample images shown above, I purposefully used a color space
wildly different from sRGB &mdash; one that I made up just for this purpose
&mdash; so that the &#8220;wrongness&#8221; would be exaggerated and
obviously apparent at first glance.</p>

<p>The next page of this article shows a variety of photos encoded with
real-world color spaces (color spaces named <i>AdobeRGB</i>,
<i>ColorMatch</i>, <i>ProPhoto</i>, <i>WideRGB</i>, and <i>AppleRGB</i>)
but without an embedded profile, allowing you to see real-world effects of
misinterpreted color.

</p>
<p><b>Continued on the Next Page</b></p>
<p>
This article continues on <a href='http://regex.info/blog/photo-tech/color-spaces-page2/'>Page 2: Test Images</a>.
</p>








]]></content:encoded>
			<wfw:commentRss>http://regex.info/blog/photo-tech/color-spaces-page1/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
