<?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>A Qualitative Analysis of NEF Compression</title>
		<link>http://regex.info/blog/photo-tech/nef-compression/</link>
		<comments>http://regex.info/blog/photo-tech/nef-compression/#comments</comments>
		<pubDate>Mon, 09 Oct 2006 15:14:49 +0000</pubDate>
		<dc:creator>Jeffrey Friedl</dc:creator>
		
		<category>General</category>

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


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

Nikon's advanced digital cameras can save images in three file formats:
jpeg, straight Raw, or compressed Raw. Whether compressed or not, the Raw files are
named with the &#8220;.NEF&#8221; (Nikon Electronic File) extension. With the 10.2
megapixel D200, an
uncompressed NEF is about 16 megabytes; the compressed NEF is about half
that size. The reduction in size is appealing, but does it come at a
reduction in quality?


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

In an excellent writeup, Fazel Majid looks at the mathematical
ramifications of NEF compression from a theoretical point of view. The
summary is that while compression does not change the dynamic range, it
&#8220;compresses 12 bits worth of data [...]]]></description>
			<content:encoded><![CDATA[

<p>

Nikon's advanced digital cameras can save images in three file formats:
jpeg, straight Raw, or compressed Raw. Whether compressed or not, the <a
href='http://en.wikipedia.org/wiki/RAW_image_format'>Raw files</a> are
named with the &#8220;.NEF&#8221; (Nikon Electronic File) extension. With the 10.2
megapixel <a href='http://regex.info/blog/2006-01-10/130'>D200</a>, an
uncompressed <span class='nef'>NEF</span> is about 16 megabytes; the compressed <span class='nef'>NEF</span> is about half
that size. The reduction in size is appealing, but does it come at a
reduction in quality?

</p>
<style>
span.nef { font-size: 95% }
</style>
<p>

In an excellent writeup, Fazel Majid looks at the <a
href='http://www.majid.info/mylos/weblog/2004/05/02-1.html'>mathematical
ramifications of <span class='nef'>NEF</span> compression</a> from a theoretical point of view. The
summary is that while compression does not change the dynamic range, it
&#8220;compresses 12 bits worth of data into 9.4 bits worth of
resolution,&#8221; and due to the way images are encoded, the lost
resolution is in the highlights. That's fine in theory, but what does this
mean for an actual image? Can a <i>human</i> ever tell the difference?

</p>

<p style='padding: 5px 7px; border: solid 1px #FCC'><b>UPDATE:</b> According to the advanced
literature, Nikon's D3 and D300 also have a compressed mode that is
lossless, making three types of NEF files that they can produced
(uncompressed, lossy compressed, and lossless compressed). This post is <b>not</b> about the new lossless NEF,
which should be, well, lossless.</p>

<p><b>The Test</b></p>

<p>

To see exactly what information is lost during compression, I set up a
high-contrast scene in my living room. I took a single picture, from which
I had the camera create both a compressed <span class='nef'>NEF</span> and
an uncompressed <span class='nef'>NEF</span>. Thus, I had two files whose
sensor data was pixel-for-pixel identical except for whatever differences
were caused by the compression.

</p><p>

(To be clear, I did not take snap two similar pictures; both the compressed
<span class='nef'>NEF</span> and uncompressed <span class='nef'>NEF</span> files were the result of the same, single shutter
release.)

</p><p>

To illustrate the full range of detail captured in each <span class='nef'>NEF</span>, I &#8220;developed&#8221;
them three ways, producing three jpegs each:</p>

<ul>
  <li>A &#8220;dark&#8221; version, to bring out highlight detail</li>
  <li>A &#8220;mid&#8221; version, balancing highlights and shadows</li>
  <li>A &#8220;bright&#8221; version, to bring out shadow detail</li>
</ul>

<p>These images are shown in the mini application further down on this
page. Mouseover the &#8220;dark,&#8221; &#8220;mid,&#8221; and
&#8220;bright&#8221; buttons to see that version, in either the
&#8220;full&#8221; (no compression) column, or the &#8220;compressed&#8221;
column.</p>

<p>(I should note here that because my livingroom is mostly white, I
sprinkled a bunch of my three-year-old's toys all around to add some color.
The house is not normally this cluttered!)</p>

<p>I didn't expect to be able to see any differences at the 8-bit jpeg
level, and indeed there are no visual difference between the pairs: the
dark version produced from the compressed <span class='nef'>NEF</span> looks identical to the dark
version produced from the uncompressed <span class='nef'>NEF</span>, and the same goes for the mid
and bright pairs as well.</p>

<p>But since there clearly <i>are</i> differences (the compression is not
lossless, so by definition, there must be differences), I moved into the
realm of raw sensor data to investigate further...</p>

<p><b>Raw Sensor Data</b></p>

<p>

I compared the two <span class='nef'>NEF</span>s in 16-bit mode, producing
a &#8220;mask&#8221; image that's black where the two <span
class='nef'>NEF</span>s are identical, and green where there are
sensor-level differences of any magnitude. Mouseover the &#8220;Mask&#8221;
button to see the mask. Switch back and forth between the
&#8220;Mask&#8221; and one of the &#8220;Mid&#8221; versions and notice
that dark areas of the scene have no differences. Fazel's analysis of the
compression (that it's lossy in the highlights) is spot on.

</p><p>

Note that even though I've shown three versions from each <span
class='nef'>NEF</span> (dark, mid, and bright), there's only one mask
image. Remember that the dark/mid/bright versions are <i>derivations</i> of
the <span class='nef'>NEF</span> that I happened to choose to illustrate
the various kinds of detail in the image. The mask compares the raw sensor
data of each <span class='nef'>NEF</span> directly.

</p><p>

The mask image shows <i>where</i> there are differences, but not the
<i>magnitude</i> of the differences, which is the real question. So, I then
produced a 16-bit &#8220;difference&#8221; image. For each color channel of each pixel,
I subtracted the data from one <span class='nef'>NEF</span> from the other. The result is pure black
where there are no differences (where the compression is lossless), and
various colors of increasing brightness for increasing differences/loss.
This is the &#8220;true difference&#8221; image.

</p><p>

You can mouseover the &#8220;True&#8221; button below to see the
true-difference image, but I'll save you the trouble by telling you that
it's black: the differences are all so subtle that they become black when
represented in an 8-bit jpeg.

</p><p>

But there <i>are</i> differences, and I want to see them, so I created an
image with the differences exaggerated. <i>Wildly</i> exaggerated.
<b>Spectacularly</b> exaggerated. Not only did I stretch the differences so
that they filled the whole 8-bit color space of the jpeg used here, but in
reducing the size (from the 3,900 &times; 2,616 original), each pixel of
the result received the <b>combined</b> differences from 36 pixels. This
means that the differences are further enhanced by an extra factor of 36.

</p><p>

Mouseover the &#8220;Exaggerated&#8221; button so see that version.

</p>

<div style='margin-top: 20px; margin-left:auto; margin-right:auto; text-align:left; height:460px; width:660px; position:relative; z-index:1; margin-bottom:0px; padding-bottom:0px; border:3px solid #ABA'>

<div id='pic3_sm_img1' class='pix'><img class='raw' indexhint='noindex'  id='img000' src='http://regex.info/i/cs/Loading.gif'        width='650' height='436'/><br/>Under-Exposed exposure: from uncompressed <span class='nef'>NEF</span></div>
<div id='pic3_sm_img2' class='pix'><img class='raw' indexhint='noindex'  id='img001' src='http://regex.info/i/cs/Loading.gif'        width='650' height='436'/><br/>Under-Exposed exposure: from compressed <span class='nef'>NEF</span></div>
<div id='pic3_sm_img3' class='pix'><img class='raw' indexhint='noindex'  id='img002' src='http://regex.info/i/cs/Loading.gif'   width='650' height='436'/><br/>Under-Exposed exposure: mask showing location of compression-related differences</div>
<div id='pic3_sm_img4' class='pix'><img class='raw' indexhint='noindex'  id='img003' src='http://regex.info/i/cs/Loading.gif'   width='650' height='436'/><br/>Under-Exposed exposure: compression-related differences wildly exaggerated</div>
<div id='pic3_sm_img5' class='pix'><img class='raw' indexhint='noindex'  id='img004' src='http://regex.info/i/cs/Loading.gif'    width='650' height='436'/><br/>Under-Exposed exposure: compression-related differences</div>
<div id='pic3_sm_img6' class='pix'><img class='raw' indexhint='noindex'  id='img005' src='http://regex.info/i/cs/Loading.gif' width='650' height='436'/><br/>Under-Exposed exposure: from uncompressed <span class='nef'>NEF</span> (brighter, to show shadow detail)</div>
<div id='pic3_sm_img7' class='pix'><img class='raw' indexhint='noindex'  id='img006' src='http://regex.info/i/cs/Loading.gif' width='650' height='436'/><br/>Under-Exposed exposure: from compressed <span class='nef'>NEF</span> (brighter, to show shadow detail)</div>
<div id='pic3_sm_img8' class='pix'><img class='raw' indexhint='noindex'  id='img007' src='http://regex.info/i/cs/Loading.gif'   width='650' height='436'/><br/>Under-Exposed exposure: from uncompressed <span class='nef'>NEF</span> (darker, to show highlight detail)</div>
<div id='pic3_sm_img9' class='pix'><img class='raw' indexhint='noindex'  id='img008' src='http://regex.info/i/cs/Loading.gif'   width='650' height='436'/><br/>Under-Exposed exposure: from compressed <span class='nef'>NEF</span> (darker, to show highlight detail)</div>
 
<div id='pic2_sm_img1' class='pix'><img class='raw'           src='http://regex.info/i/raw/pic2/full-sm.jpg'        width='650' height='436'/><br/>from uncompressed <span class='nef'>NEF</span></div>
<div id='pic2_sm_img2' class='pix'><img class='raw' indexhint='noindex'  src='http://regex.info/i/raw/pic2/comp-sm.jpg'        width='650' height='436'/><br/>from compressed <span class='nef'>NEF</span></div>
<div id='pic2_sm_img3' class='pix'><img class='raw'           src='http://regex.info/i/raw/pic2/diff_mask-sm.gif'   width='650' height='436'/><br/>mask showing location of compression-related differences</div>
<div id='pic2_sm_img4' class='pix'><img class='raw' indexhint='noindex'  src='http://regex.info/i/raw/pic2/diff_wide-sm.jpg'   width='650' height='436'/><br/>compression-related differences wildly exaggerated</div>
<div id='pic2_sm_img5' class='pix'><img class='raw' indexhint='noindex'  src='http://regex.info/i/raw/pic2/diff_raw-sm.jpg'    width='650' height='436'/><br/>compression-related differences</div>
<div id='pic2_sm_img6' class='pix'><img class='raw' indexhint='noindex'  src='http://regex.info/i/raw/pic2/full_bright-sm.jpg' width='650' height='436'/><br/>from uncompressed <span class='nef'>NEF</span> (brighter, to show shadow detail)</div>
<div id='pic2_sm_img7' class='pix'><img class='raw' indexhint='noindex'  src='http://regex.info/i/raw/pic2/comp_bright-sm.jpg' width='650' height='436'/><br/>from compressed <span class='nef'>NEF</span> (brighter, to show shadow detail)</div>
<div id='pic2_sm_img8' class='pix'><img class='raw' indexhint='noindex'  src='http://regex.info/i/raw/pic2/full_dark-sm.jpg'   width='650' height='436'/><br/>from uncompressed <span class='nef'>NEF</span> (darker, to show highlight detail)</div>
<div id='pic2_sm_img9' class='pix'><img class='raw' indexhint='noindex'  src='http://regex.info/i/raw/pic2/comp_dark-sm.jpg'   width='650' height='436'/><br/>from compressed <span class='nef'>NEF</span> (darker, to show highlight detail)</div>
 
<div id='pic1_sm_img1' class='pix'><img class='raw' indexhint='noindex'  id='img036' src='http://regex.info/i/cs/Loading.gif'        width='650' height='436'/><br/>Over-Exposed exposure: from uncompressed <span class='nef'>NEF</span></div>
<div id='pic1_sm_img2' class='pix'><img class='raw' indexhint='noindex'  id='img037' src='http://regex.info/i/cs/Loading.gif'        width='650' height='436'/><br/>Over-Exposed exposure: from compressed <span class='nef'>NEF</span></div>
<div id='pic1_sm_img3' class='pix'><img class='raw' indexhint='noindex'  id='img038' src='http://regex.info/i/cs/Loading.gif'   width='650' height='436'/><br/>Over-Exposed exposure: mask showing location of compression-related differences</div>
<div id='pic1_sm_img4' class='pix'><img class='raw' indexhint='noindex'  id='img039' src='http://regex.info/i/cs/Loading.gif'   width='650' height='436'/><br/>Over-Exposed exposure: compression-related differences wildly exaggerated</div>
<div id='pic1_sm_img5' class='pix'><img class='raw' indexhint='noindex'  id='img040' src='http://regex.info/i/cs/Loading.gif'    width='650' height='436'/><br/>Over-Exposed exposure: compression-related differences</div>
<div id='pic1_sm_img6' class='pix'><img class='raw' indexhint='noindex'  id='img041' src='http://regex.info/i/cs/Loading.gif' width='650' height='436'/><br/>Over-Exposed exposure: from uncompressed <span class='nef'>NEF</span> (brighter, to show shadow detail)</div>
<div id='pic1_sm_img7' class='pix'><img class='raw' indexhint='noindex'  id='img042' src='http://regex.info/i/cs/Loading.gif' width='650' height='436'/><br/>Over-Exposed exposure: from compressed <span class='nef'>NEF</span> (brighter, to show shadow detail)</div>
<div id='pic1_sm_img8' class='pix'><img class='raw' indexhint='noindex'  id='img043' src='http://regex.info/i/cs/Loading.gif'   width='650' height='436'/><br/>Over-Exposed exposure: from uncompressed <span class='nef'>NEF</span> (darker, to show highlight detail)</div>
<div id='pic1_sm_img9' class='pix'><img class='raw' indexhint='noindex'  id='img044' src='http://regex.info/i/cs/Loading.gif'   width='650' height='436'/><br/>Over-Exposed exposure: from compressed <span class='nef'>NEF</span> (darker, to show highlight detail)</div>


<div id='pic3_c1_img1' class='pix'><img class='raw' indexhint='noindex'  id='img009' src='http://regex.info/i/cs/Loading.gif'        width='650' height='436'/><br/>Under-Exposed exposure: 100% crop from uncompressed <span class='nef'>NEF</span></div>
<div id='pic3_c1_img2' class='pix'><img class='raw' indexhint='noindex'  id='img010' src='http://regex.info/i/cs/Loading.gif'        width='650' height='436'/><br/>Under-Exposed exposure: 100% crop from compressed <span class='nef'>NEF</span></div>
<div id='pic3_c1_img3' class='pix'><img class='raw' indexhint='noindex'  id='img011' src='http://regex.info/i/cs/Loading.gif'   width='650' height='436'/><br/>Under-Exposed exposure: 100% crop of mask showing location of compression-related differences</div>
<div id='pic3_c1_img4' class='pix'><img class='raw' indexhint='noindex'  id='img012' src='http://regex.info/i/cs/Loading.gif'   width='650' height='436'/><br/>Under-Exposed exposure: 100% crop: compression-related differences wildly exaggerated</div>
<div id='pic3_c1_img5' class='pix'><img class='raw' indexhint='noindex'  id='img013' src='http://regex.info/i/cs/Loading.gif'    width='650' height='436'/><br/>Under-Exposed exposure: 100% crop of compression-related differences</div>
<div id='pic3_c1_img6' class='pix'><img class='raw' indexhint='noindex'  id='img014' src='http://regex.info/i/cs/Loading.gif' width='650' height='436'/><br/>Under-Exposed exposure: 100% crop from uncompressed <span class='nef'>NEF</span> (brighter, to show shadow detail)</div>
<div id='pic3_c1_img7' class='pix'><img class='raw' indexhint='noindex'  id='img015' src='http://regex.info/i/cs/Loading.gif' width='650' height='436'/><br/>Under-Exposed exposure: 100% crop from compressed <span class='nef'>NEF</span> (brighter, to show shadow detail)</div>
<div id='pic3_c1_img8' class='pix'><img class='raw' indexhint='noindex'  id='img016' src='http://regex.info/i/cs/Loading.gif'   width='650' height='436'/><br/>Under-Exposed exposure: 100% crop from uncompressed <span class='nef'>NEF</span> (darker, to show highlight detail)</div>
<div id='pic3_c1_img9' class='pix'><img class='raw' indexhint='noindex'  id='img017' src='http://regex.info/i/cs/Loading.gif'   width='650' height='436'/><br/>Under-Exposed exposure: 100% crop from compressed <span class='nef'>NEF</span> (darker, to show highlight detail)</div>
 
<div id='pic2_c1_img1' class='pix'><img class='raw' indexhint='noindex'  src='http://regex.info/i/raw/pic2/full-c1.jpg'        width='650' height='436'/><br/>100% crop from uncompressed <span class='nef'>NEF</span></div>
<div id='pic2_c1_img2' class='pix'><img class='raw' indexhint='noindex'  src='http://regex.info/i/raw/pic2/comp-c1.jpg'        width='650' height='436'/><br/>100% crop from compressed <span class='nef'>NEF</span></div>
<div id='pic2_c1_img3' class='pix'><img class='raw' indexhint='noindex'  src='http://regex.info/i/raw/pic2/diff_mask-c1.gif'   width='650' height='436'/><br/>100% crop of mask showing location of compression-related differences</div>
<div id='pic2_c1_img4' class='pix'><img class='raw' indexhint='noindex'  src='http://regex.info/i/raw/pic2/diff_wide-c1.jpg'   width='650' height='436'/><br/>100% crop: compression-related differences wildly exaggerated</div>
<div id='pic2_c1_img5' class='pix'><img class='raw' indexhint='noindex'  src='http://regex.info/i/raw/pic2/diff_raw-c1.jpg'    width='650' height='436'/><br/>100% crop of compression-related differences</div>
<div id='pic2_c1_img6' class='pix'><img class='raw' indexhint='noindex'  src='http://regex.info/i/raw/pic2/full_bright-c1.jpg' width='650' height='436'/><br/>100% crop from uncompressed <span class='nef'>NEF</span> (brighter, to show shadow detail)</div>
<div id='pic2_c1_img7' class='pix'><img class='raw' indexhint='noindex'  src='http://regex.info/i/raw/pic2/comp_bright-c1.jpg' width='650' height='436'/><br/>100% crop from compressed <span class='nef'>NEF</span> (brighter, to show shadow detail)</div>
<div id='pic2_c1_img8' class='pix'><img class='raw' indexhint='noindex'  src='http://regex.info/i/raw/pic2/full_dark-c1.jpg'   width='650' height='436'/><br/>100% crop from uncompressed <span class='nef'>NEF</span> (darker, to show highlight detail)</div>
<div id='pic2_c1_img9' class='pix'><img class='raw' indexhint='noindex'  src='http://regex.info/i/raw/pic2/comp_dark-c1.jpg'   width='650' height='436'/><br/>100% crop from compressed <span class='nef'>NEF</span> (darker, to show highlight detail)</div>
 
<div id='pic1_c1_img1' class='pix'><img class='raw' indexhint='noindex'  id='img045' src='http://regex.info/i/cs/Loading.gif'        width='650' height='436'/><br/>Over-Exposed exposure: 100% crop from uncompressed <span class='nef'>NEF</span></div>
<div id='pic1_c1_img2' class='pix'><img class='raw' indexhint='noindex'  id='img046' src='http://regex.info/i/cs/Loading.gif'        width='650' height='436'/><br/>Over-Exposed exposure: 100% crop from compressed <span class='nef'>NEF</span></div>
<div id='pic1_c1_img3' class='pix'><img class='raw' indexhint='noindex'  id='img047' src='http://regex.info/i/cs/Loading.gif'   width='650' height='436'/><br/>Over-Exposed exposure: 100% crop of mask showing location of compression-related differences</div>
<div id='pic1_c1_img4' class='pix'><img class='raw' indexhint='noindex'  id='img048' src='http://regex.info/i/cs/Loading.gif'   width='650' height='436'/><br/>Over-Exposed exposure: 100% crop: compression-related differences wildly exaggerated</div>
<div id='pic1_c1_img5' class='pix'><img class='raw' indexhint='noindex'  id='img049' src='http://regex.info/i/cs/Loading.gif'    width='650' height='436'/><br/>Over-Exposed exposure: 100% crop of compression-related differences</div>
<div id='pic1_c1_img6' class='pix'><img class='raw' indexhint='noindex'  id='img050' src='http://regex.info/i/cs/Loading.gif' width='650' height='436'/><br/>Over-Exposed exposure: 100% crop from uncompressed <span class='nef'>NEF</span> (brighter, to show shadow detail)</div>
<div id='pic1_c1_img7' class='pix'><img class='raw' indexhint='noindex'  id='img051' src='http://regex.info/i/cs/Loading.gif' width='650' height='436'/><br/>Over-Exposed exposure: 100% crop from compressed <span class='nef'>NEF</span> (brighter, to show shadow detail)</div>
<div id='pic1_c1_img8' class='pix'><img class='raw' indexhint='noindex'  id='img052' src='http://regex.info/i/cs/Loading.gif'   width='650' height='436'/><br/>Over-Exposed exposure: 100% crop from uncompressed <span class='nef'>NEF</span> (darker, to show highlight detail)</div>
<div id='pic1_c1_img9' class='pix'><img class='raw' indexhint='noindex'  id='img053' src='http://regex.info/i/cs/Loading.gif'   width='650' height='436'/><br/>Over-Exposed exposure: 100% crop from compressed <span class='nef'>NEF</span> (darker, to show highlight detail)</div>


<div id='pic3_c2_img1' class='pix'><img class='raw' indexhint='noindex'  id='img018' src='http://regex.info/i/cs/Loading.gif'        width='650' height='436'/><br/>Under-Exposed exposure: 100% crop from uncompressed <span class='nef'>NEF</span></div>
<div id='pic3_c2_img2' class='pix'><img class='raw' indexhint='noindex'  id='img019' src='http://regex.info/i/cs/Loading.gif'        width='650' height='436'/><br/>Under-Exposed exposure: 100% crop from compressed <span class='nef'>NEF</span></div>
<div id='pic3_c2_img3' class='pix'><img class='raw' indexhint='noindex'  id='img020' src='http://regex.info/i/cs/Loading.gif'   width='650' height='436'/><br/>Under-Exposed exposure: 100% crop of mask showing location of compression-related differences</div>
<div id='pic3_c2_img4' class='pix'><img class='raw' indexhint='noindex'  id='img021' src='http://regex.info/i/cs/Loading.gif'   width='650' height='436'/><br/>Under-Exposed exposure: 100% crop: compression-related differences wildly exaggerated</div>
<div id='pic3_c2_img5' class='pix'><img class='raw' indexhint='noindex'  id='img022' src='http://regex.info/i/cs/Loading.gif'    width='650' height='436'/><br/>Under-Exposed exposure: 100% crop of compression-related differences</div>
<div id='pic3_c2_img6' class='pix'><img class='raw' indexhint='noindex'  id='img023' src='http://regex.info/i/cs/Loading.gif' width='650' height='436'/><br/>Under-Exposed exposure: 100% crop from uncompressed <span class='nef'>NEF</span> (brighter, to show shadow detail)</div>
<div id='pic3_c2_img7' class='pix'><img class='raw' indexhint='noindex'  id='img024' src='http://regex.info/i/cs/Loading.gif' width='650' height='436'/><br/>Under-Exposed exposure: 100% crop from compressed <span class='nef'>NEF</span> (brighter, to show shadow detail)</div>
<div id='pic3_c2_img8' class='pix'><img class='raw' indexhint='noindex'  id='img025' src='http://regex.info/i/cs/Loading.gif'   width='650' height='436'/><br/>Under-Exposed exposure: 100% crop from uncompressed <span class='nef'>NEF</span> (darker, to show highlight detail)</div>
<div id='pic3_c2_img9' class='pix'><img class='raw' indexhint='noindex'  id='img026' src='http://regex.info/i/cs/Loading.gif'   width='650' height='436'/><br/>Under-Exposed exposure: 100% crop from compressed <span class='nef'>NEF</span> (darker, to show highlight detail)</div>
 
<div id='pic2_c2_img1' class='pix'><img class='raw' indexhint='noindex'  src='http://regex.info/i/raw/pic2/full-c2.jpg'        width='650' height='436'/><br/>100% crop from uncompressed <span class='nef'>NEF</span></div>
<div id='pic2_c2_img2' class='pix'><img class='raw' indexhint='noindex'  src='http://regex.info/i/raw/pic2/comp-c2.jpg'        width='650' height='436'/><br/>100% crop from compressed <span class='nef'>NEF</span></div>
<div id='pic2_c2_img3' class='pix'><img class='raw' indexhint='noindex'  src='http://regex.info/i/raw/pic2/diff_mask-c2.gif'   width='650' height='436'/><br/>100% crop of mask showing location of compression-related differences</div>
<div id='pic2_c2_img4' class='pix'><img class='raw' indexhint='noindex'  src='http://regex.info/i/raw/pic2/diff_wide-c2.jpg'   width='650' height='436'/><br/>100% crop: compression-related differences wildly exaggerated</div>
<div id='pic2_c2_img5' class='pix'><img class='raw' indexhint='noindex'  src='http://regex.info/i/raw/pic2/diff_raw-c2.jpg'    width='650' height='436'/><br/>100% crop of compression-related differences</div>
<div id='pic2_c2_img6' class='pix'><img class='raw' indexhint='noindex'  src='http://regex.info/i/raw/pic2/full_bright-c2.jpg' width='650' height='436'/><br/>100% crop from uncompressed <span class='nef'>NEF</span> (brighter, to show shadow detail)</div>
<div id='pic2_c2_img7' class='pix'><img class='raw' indexhint='noindex'  src='http://regex.info/i/raw/pic2/comp_bright-c2.jpg' width='650' height='436'/><br/>100% crop from compressed <span class='nef'>NEF</span> (brighter, to show shadow detail)</div>
<div id='pic2_c2_img8' class='pix'><img class='raw' indexhint='noindex'  src='http://regex.info/i/raw/pic2/full_dark-c2.jpg'   width='650' height='436'/><br/>100% crop from uncompressed <span class='nef'>NEF</span> (darker, to show highlight detail)</div>
<div id='pic2_c2_img9' class='pix'><img class='raw' indexhint='noindex'  src='http://regex.info/i/raw/pic2/comp_dark-c2.jpg'   width='650' height='436'/><br/>100% crop from compressed <span class='nef'>NEF</span> (darker, to show highlight detail)</div>
 
<div id='pic1_c2_img1' class='pix'><img class='raw' indexhint='noindex'  id='img054' src='http://regex.info/i/cs/Loading.gif'        width='650' height='436'/><br/>Over-Exposed exposure: 100% crop from uncompressed <span class='nef'>NEF</span></div>
<div id='pic1_c2_img2' class='pix'><img class='raw' indexhint='noindex'  id='img055' src='http://regex.info/i/cs/Loading.gif'        width='650' height='436'/><br/>Over-Exposed exposure: 100% crop from compressed <span class='nef'>NEF</span></div>
<div id='pic1_c2_img3' class='pix'><img class='raw' indexhint='noindex'  id='img056' src='http://regex.info/i/cs/Loading.gif'   width='650' height='436'/><br/>Over-Exposed exposure: 100% crop of mask showing location of compression-related differences</div>
<div id='pic1_c2_img4' class='pix'><img class='raw' indexhint='noindex'  id='img057' src='http://regex.info/i/cs/Loading.gif'   width='650' height='436'/><br/>Over-Exposed exposure: 100% crop: compression-related differences wildly exaggerated</div>
<div id='pic1_c2_img5' class='pix'><img class='raw' indexhint='noindex'  id='img058' src='http://regex.info/i/cs/Loading.gif'    width='650' height='436'/><br/>Over-Exposed exposure: 100% crop of compression-related differences</div>
<div id='pic1_c2_img6' class='pix'><img class='raw' indexhint='noindex'  id='img059' src='http://regex.info/i/cs/Loading.gif' width='650' height='436'/><br/>Over-Exposed exposure: 100% crop from uncompressed <span class='nef'>NEF</span> (brighter, to show shadow detail)</div>
<div id='pic1_c2_img7' class='pix'><img class='raw' indexhint='noindex'  id='img060' src='http://regex.info/i/cs/Loading.gif' width='650' height='436'/><br/>Over-Exposed exposure: 100% crop from compressed <span class='nef'>NEF</span> (brighter, to show shadow detail)</div>
<div id='pic1_c2_img8' class='pix'><img class='raw' indexhint='noindex'  id='img061' src='http://regex.info/i/cs/Loading.gif'   width='650' height='436'/><br/>Over-Exposed exposure: 100% crop from uncompressed <span class='nef'>NEF</span> (darker, to show highlight detail)</div>
<div id='pic1_c2_img9' class='pix'><img class='raw' indexhint='noindex'  id='img062' src='http://regex.info/i/cs/Loading.gif'   width='650' height='436'/><br/>Over-Exposed exposure: 100% crop from compressed <span class='nef'>NEF</span> (darker, to show highlight detail)</div>


<div id='pic3_c3_img1' class='pix'><img class='raw' indexhint='noindex'  id='img027' src='http://regex.info/i/cs/Loading.gif'        width='650' height='436'/><br/>Under-Exposed exposure: 100% crop from uncompressed <span class='nef'>NEF</span></div>
<div id='pic3_c3_img2' class='pix'><img class='raw' indexhint='noindex'  id='img028' src='http://regex.info/i/cs/Loading.gif'        width='650' height='436'/><br/>Under-Exposed exposure: 100% crop from compressed <span class='nef'>NEF</span></div>
<div id='pic3_c3_img3' class='pix'><img class='raw' indexhint='noindex'  id='img029' src='http://regex.info/i/cs/Loading.gif'   width='650' height='436'/><br/>Under-Exposed exposure: 100% crop of mask showing location of compression-related differences</div>
<div id='pic3_c3_img4' class='pix'><img class='raw' indexhint='noindex'  id='img030' src='http://regex.info/i/cs/Loading.gif'   width='650' height='436'/><br/>Under-Exposed exposure: 100% crop: compression-related differences wildly exaggerated</div>
<div id='pic3_c3_img5' class='pix'><img class='raw' indexhint='noindex'  id='img031' src='http://regex.info/i/cs/Loading.gif'    width='650' height='436'/><br/>Under-Exposed exposure: 100% crop of compression-related differences</div>
<div id='pic3_c3_img6' class='pix'><img class='raw' indexhint='noindex'  id='img032' src='http://regex.info/i/cs/Loading.gif' width='650' height='436'/><br/>Under-Exposed exposure: 100% crop from uncompressed <span class='nef'>NEF</span> (brighter, to show shadow detail)</div>
<div id='pic3_c3_img7' class='pix'><img class='raw' indexhint='noindex'  id='img033' src='http://regex.info/i/cs/Loading.gif' width='650' height='436'/><br/>Under-Exposed exposure: 100% crop from compressed <span class='nef'>NEF</span> (brighter, to show shadow detail)</div>
<div id='pic3_c3_img8' class='pix'><img class='raw' indexhint='noindex'  id='img034' src='http://regex.info/i/cs/Loading.gif'   width='650' height='436'/><br/>Under-Exposed exposure: 100% crop from uncompressed <span class='nef'>NEF</span> (darker, to show highlight detail)</div>
<div id='pic3_c3_img9' class='pix'><img class='raw' indexhint='noindex'  id='img035' src='http://regex.info/i/cs/Loading.gif'   width='650' height='436'/><br/>Under-Exposed exposure: 100% crop from compressed <span class='nef'>NEF</span> (darker, to show highlight detail)</div>
 
<div id='pic2_c3_img1' class='pix'><img class='raw' indexhint='noindex'  src='http://regex.info/i/raw/pic2/full-c3.jpg'        width='650' height='436'/><br/>100% crop from uncompressed <span class='nef'>NEF</span></div>
<div id='pic2_c3_img2' class='pix'><img class='raw' indexhint='noindex'  src='http://regex.info/i/raw/pic2/comp-c3.jpg'        width='650' height='436'/><br/>100% crop from compressed <span class='nef'>NEF</span></div>
<div id='pic2_c3_img3' class='pix'><img class='raw' indexhint='noindex'  src='http://regex.info/i/raw/pic2/diff_mask-c3.gif'   width='650' height='436'/><br/>100% crop of mask showing location of compression-related differences</div>
<div id='pic2_c3_img4' class='pix'><img class='raw' indexhint='noindex'  src='http://regex.info/i/raw/pic2/diff_wide-c3.jpg'   width='650' height='436'/><br/>100% crop: compression-related differences wildly exaggerated</div>
<div id='pic2_c3_img5' class='pix'><img class='raw' indexhint='noindex'  src='http://regex.info/i/raw/pic2/diff_raw-c3.jpg'    width='650' height='436'/><br/>100% crop of compression-related differences</div>
<div id='pic2_c3_img6' class='pix'><img class='raw' indexhint='noindex'  src='http://regex.info/i/raw/pic2/full_bright-c3.jpg' width='650' height='436'/><br/>100% crop from uncompressed <span class='nef'>NEF</span> (brighter, to show shadow detail)</div>
<div id='pic2_c3_img7' class='pix'><img class='raw' indexhint='noindex'  src='http://regex.info/i/raw/pic2/comp_bright-c3.jpg' width='650' height='436'/><br/>100% crop from compressed <span class='nef'>NEF</span> (brighter, to show shadow detail)</div>
<div id='pic2_c3_img8' class='pix'><img class='raw' indexhint='noindex'  src='http://regex.info/i/raw/pic2/full_dark-c3.jpg'   width='650' height='436'/><br/>100% crop from uncompressed <span class='nef'>NEF</span> (darker, to show highlight detail)</div>
<div id='pic2_c3_img9' class='pix'><img class='raw' indexhint='noindex'  src='http://regex.info/i/raw/pic2/comp_dark-c3.jpg'   width='650' height='436'/><br/>100% crop from compressed <span class='nef'>NEF</span> (darker, to show highlight detail)</div>
 
<div id='pic1_c3_img1' class='pix'><img class='raw' indexhint='noindex'  id='img063' src='http://regex.info/i/cs/Loading.gif'        width='650' height='436'/><br/>Over-Exposed exposure: 100% crop from uncompressed <span class='nef'>NEF</span></div>
<div id='pic1_c3_img2' class='pix'><img class='raw' indexhint='noindex'  id='img064' src='http://regex.info/i/cs/Loading.gif'        width='650' height='436'/><br/>Over-Exposed exposure: 100% crop from compressed <span class='nef'>NEF</span></div>
<div id='pic1_c3_img3' class='pix'><img class='raw' indexhint='noindex'  id='img065' src='http://regex.info/i/cs/Loading.gif'   width='650' height='436'/><br/>Over-Exposed exposure: 100% crop of mask showing location of compression-related differences</div>
<div id='pic1_c3_img4' class='pix'><img class='raw' indexhint='noindex'  id='img066' src='http://regex.info/i/cs/Loading.gif'   width='650' height='436'/><br/>Over-Exposed exposure: 100% crop: compression-related differences wildly exaggerated</div>
<div id='pic1_c3_img5' class='pix'><img class='raw' indexhint='noindex'  id='img067' src='http://regex.info/i/cs/Loading.gif'    width='650' height='436'/><br/>Over-Exposed exposure: 100% crop of compression-related differences</div>
<div id='pic1_c3_img6' class='pix'><img class='raw' indexhint='noindex'  id='img068' src='http://regex.info/i/cs/Loading.gif' width='650' height='436'/><br/>Over-Exposed exposure: 100% crop from uncompressed <span class='nef'>NEF</span> (brighter, to show shadow detail)</div>
<div id='pic1_c3_img7' class='pix'><img class='raw' indexhint='noindex'  id='img069' src='http://regex.info/i/cs/Loading.gif' width='650' height='436'/><br/>Over-Exposed exposure: 100% crop from compressed <span class='nef'>NEF</span> (brighter, to show shadow detail)</div>
<div id='pic1_c3_img8' class='pix'><img class='raw' indexhint='noindex'  id='img070' src='http://regex.info/i/cs/Loading.gif'   width='650' height='436'/><br/>Over-Exposed exposure: 100% crop from uncompressed <span class='nef'>NEF</span> (darker, to show highlight detail)</div>
<div id='pic1_c3_img9' class='pix'><img class='raw' indexhint='noindex'  id='img071' src='http://regex.info/i/cs/Loading.gif'   width='650' height='436'/><br/>Over-Exposed exposure: 100% crop from compressed <span class='nef'>NEF</span> (darker, to show highlight detail)</div>

<div style='visibility:hidden' id='shadow' class='shadow'></div>
<div style='visibility:hidden' id='note_full' class='note' onclick='ClearNote()'><div class='outernote'><p>

   <b>These buttons show representative jpeg views from the two <span
   class='nef'>NEF</span>s. The three dark/mid/bright buttons on the left
   are for the uncompressed <span class='nef'>NEF</span>, while the three
   on the right are for the compressed <span class='nef'>NEF</span>.</b>

   </p><p>

   There are three versions for each <span class='nef'>NEF</span> to
   illustrate the detail in different areas of the high-contrast image.

   </p><p>

   Differences due to compression should theoretically show up when
   comparing the pairs (e.g. the right-side Dark with the
   left-side Dark), but no differences are apparent because the sensor-level differences
   are too subtle to show up in an 8-bit jpeg.

   </p><p></p><p></p><div class='click_to_close'>(click window to close)</div>

</div></div>
<div style='visibility:hidden' id='note_mask'  class='note' onclick='ClearNote()'><div class='outernote'><p>

   <b>The &#8220;Difference Mask&#8221; button shows which pixels have <i>any</i> sensor-level difference between the compressed and uncompressed raw files.</b>

   </p><p>

   To be clear, the mask is related the two original raw files &ndash;
   compressed and uncompressed &ndash; derived from a single
   shutter-release event. The mask is not directly related to the six
   dark/mid/bright views, which are merely derived from the raw files.

   </p><p>

   The mask differences are checked in 16-bit, raw sensor-data mode.

   </p><p></p><p></p><div class='click_to_close'>(click window to close)</div>
</div></div>
<div style='visibility:hidden' id='note_true'  class='note' onclick='ClearNote()'><div class='outernote'><p>

   <b>The &#8220;True Differences&#8221; button shows the difference
      between two raw files &ndash; compressed and uncompressed &ndash;
      derived from the same shutter release.</b> The difference is computed
      with raw 16-bit sensor data, prior to any gamma or color correction.

     </p><p>

      The 16-bit-mode result was then converted to an 8-bit sRGB jpeg.
      Because the differences are far too minor to show up in an 8-bit
      color space, the image shown here is black.

     </p><p></p><p></p><div class='click_to_close'>(click window to close)</div>
</div></div>
<div style='visibility:hidden' id='note_ex'  class='note' onclick='ClearNote()'><div class='outernote'><p>

   <b>The &#8220;Exaggerated Diff&#8221; button shows the raw 16-bit
      differences between the two raw files &ndash; compressed and
      uncompressed &ndash; expanded to fill the entire 8-bit RGB range of
      an sRGB jpeg.</b> This is to vividly illustrate the difference
      between the two raw files. Any detail that can be seen in this
      version represents detail lost during <span class='nef'>NEF</span>
      compression.

  </p><p>Remember that the true lost detail is <i>exceedingly</i> more
         subtle than shown in this exaggerated version; see the text for details.

   </p><p></p><p></p><div class='click_to_close'>(click window to close)</div>
</div></div>

<div style='visibility:hidden' id='note_crop'  class='note' onclick='ClearNote()'><div class='outernote'><p>
   <b>The &#8220;Crop&#8221; buttons select what part of the original photo is viewed with the nine &#8220;View&#8221; buttons on the right.</b>
</p><p>
      The &#8220;Full Scene&#8221; button selects a small-sized version of the original 10.2 megapixel (3,900 &times; 2,616) image.
      The other buttons select 100% crops of selected areas of interest in the full scene.
   </p><p></p><p></p><div class='click_to_close'>(click window to close)</div>
</div></div>

<div style='visibility:hidden' id='note_pic'  class='note' onclick='ClearNote()'><div class='outernote'><p>
   <b>The three &#8220;Photo&#8221; buttons select which photo all other buttons/views work with.</b>

   </p><p>Each photo is a separate shutter-release event. The two
non-&#8220;primary&#8221; shots were over/under exposed by two stops,
resulting in a lot of highlight/shadow clipping. <span class='nef'>NEF</span> compression is lossy
in the highlights, so the over-exposed photo shows the most differences.

   </p><p></p><p></p><div class='click_to_close'>(click window to close)</div>
</div></div>
</div>

<style>
div.pix {
   position:absolute;
   left:5; top:5;
   display:none;
   font-size: 85%;
}
.note {
  height:320;
  position:absolute;
  left:60;
  top:70;
  width:540;
  background-color:#A84;
  border-top:    solid 3px #CA6;
  border-right:  solid 3px #CA6;
  border-bottom: solid 3px #652;
  border-left:   solid 3px #652;
}
.prettybutton {
  padding: 0px 10px;
  color: black;
  margin-right:20px;
  background-color:#CA7;
  font-size: 90%;
  border-top:    solid 3px #CA6;
  border-right:  solid 3px #CA6;
  border-bottom: solid 3px #652;
  border-left:   solid 3px #652;
}
div.shadow {
   position:absolute;
   left:55;
   top:82;
   width:540;
   height:320;
   background-color:black;
   opacity:0.65
}
div.click_to_close {
   position:absolute;
   bottom:15px;
   font-size: 85%;
   text-align:center;
   width:540;
   color:#555
}
div.outernote {
  text-align: left;
  height: 295;
  margin: 10px;
  padding: 0 20px;

  border-bottom: solid 3px #CA6;
  border-left:   solid 3px #CA6;
  border-top:    solid 3px #652;
  border-right:  solid 3px #652;
}

.b     { padding: 1px 5px; border: #FF4040 1px solid; margin: 5px; color: white; background-color: #808080  }
.xb    { padding: 1px 5px; border: gray    1px solid; margin: 5px; color: black; background-color: white    }

.pb     { padding: 1px 5px; border: #FF4040 1px solid; margin: 5px; color: white; background-color: #808080  }
.xpb    { padding: 1px 5px; border: gray    1px solid; margin: 5px; color: black; background-color: white    }

.cb     { padding: 1px 5px; border: #FF4040 1px solid; margin: 5px; color: white; background-color: #808080  }
.xcb    { padding: 1px 5px; border: gray    1px solid; margin: 5px; color: black; background-color: white    }
.h      { padding-bottom: 5px }

</style>

<table border='0' cellpadding='0' cellspacing='0' style='margin: 0 auto'>
<tr valign='top'>
<td id='t1' style='visibility:hidden; border-top:0; margin-top:0'>
   <table cellspacing='5' cellpadding='0' style='margin-right:20px'>
     <tr><td align='center' class='h'><b>Photo</b><br/><small><i>click</i> to select</small></td></tr>
     <tr><td style='font-size:85%' class='xpb' id='bp_pic3' onclick='OnPic("pic3")'>Under-Exposed</td></tr>
 <tr><td style='font-size:85%' class='xpb' id='bp_pic2' onclick='OnPic("pic2")'>Primary</td></tr>
 <tr><td style='font-size:85%' class='xpb' id='bp_pic1' onclick='OnPic("pic1")'>Over-Exposed</td></tr>

     <tr><td onclick='ToggleNote("note_pic")' align='center' style='font-size:80%' onmouseover='HMOver(this)' onmouseout='HMOut(this)' >(click for help)</td></tr>
   </table>
</td>
<td id='t2' style='visibility:hidden; border-top:0; margin-top:0'>
   <table cellspacing='5' cellpadding='0' style='margin-right:20px'>
     <tr><td align='center' class='h'><b>Crop</b><br/><small><i>click</i>&nbsp;to&nbsp;select</small></td></tr>
     <tr><td align='center' style='font-size:90%' id='cb_sm' onclick='OnCrop("sm")'>Full&nbsp;Scene</td></tr>
     <tr><td align='center' style='font-size:85%' id='cb_c1' onclick='OnCrop("c1")'>100%&nbsp;Crop&nbsp;1</td></tr>
     <tr><td align='center' style='font-size:85%' id='cb_c2' onclick='OnCrop("c2")'>100%&nbsp;Crop&nbsp;2</td></tr>
     <tr><td align='center' style='font-size:85%' id='cb_c3' onclick='OnCrop("c3")'>100%&nbsp;Crop&nbsp;3</td></tr>
     <tr><td align='center' onclick='ToggleNote("note_crop")' style='font-size:80%' onmouseover='HMOver(this)' onmouseout='HMOut(this)'>(click for help)</td></tr>
   </table>
</td>
<td align='center'>
 <table cellspacing='5' cellpadding='0'>
     <tr><td align='center' colspan='5' class='h' style='border-bottom: dotted 1px gray'>

<span id='reset' class='prettybutton' onmouseover='HMOver(this)' onmouseout='HMOut(this)' onclick='Reset()' style='visibility:hidden'>reset</span>


<b>View</b>&nbsp;&nbsp;<small>(<i>mouseover</i> to select)</small></td></tr>
     <tr align='center'>
         <td rowspan='3'>
             <table style='padding: 0 5px; background-color:#CDC'>
               <tr align='center' style='font-size:90%'><td><b>Full</b></td><td style='padding: 0 5px'><b>Compressed</b></td></tr>
               <tr align='center' ><td class='xb' id='but8' full='1' onmouseover='OnButton(8)'>Dark</td>
                   <td class='xb' id='but9' comp='1' onmouseover='OnButton(9)'>Dark</td></tr>

               <tr align='center' ><td class='xb' id='but1' full='1' onmouseover='OnButton(1)'>Mid</td>
                   <td class='xb' id='but2' comp='1' onmouseover='OnButton(2)'>Mid</td></tr>

               <tr align='center' ><td class='xb' id='but6' full='1' onmouseover='OnButton(6)'>Bright</td>
                   <td class='xb' id='but7' comp='1' onmouseover='OnButton(7)'>Bright</td></tr>

               <tr><td colspan='2' onclick='ToggleNote("note_full")' align='center' style='font-size:80%' onmouseover='HMOver(this)' onmouseout='HMOut(this)' >(click for help)</td></tr>

             </table>
         </td>
         <td colspan='3' align='center' style='border-bottom:solid 1px #C8D8C8'><b>Difference</b></td></tr>
         <tr>
           <td><div class='xb' id='but3' onmouseover='OnButton(3)' align='center'>Mask</div></td>
           <td><div class='xb' id='but5' onmouseover='OnButton(5)' align='center'>True</div></td>
           <td><div class='xb' id='but4' onmouseover='OnButton(4)' align='center'>Exaggerated</div></td>
        </tr>
 <tr>
   <td onclick='OnButton(3);ToggleNote("note_mask")' align='center' style='font-size:80%' onmouseover='HMOver(this)' onmouseout='HMOut(this)' >(click for help)</td>
   <td onclick='OnButton(5);ToggleNote("note_true")' align='center' style='font-size:80%' onmouseover='HMOver(this)' onmouseout='HMOut(this)' >(click for help)</td>
   <td onclick='OnButton(4);ToggleNote("note_ex")'   align='center' style='font-size:80%' onmouseover='HMOver(this)' onmouseout='HMOut(this)' >(click for help)</td>
</tr>

 </table>
</td></tr>
</table>

<div id='log' style="display:none; border:red 5px dotted; font-size: 80%">LOG:</div>
<script>
function HMOver(obj)
{
    obj.style.color= "red";
}
function HMOut(obj)
{
    obj.style.color= "black";
}


function log(msg)
{
  var obj = document.getElementById("log");
  obj.innerHTML += "<br/>" + msg;
  obj.style.display = "";
}
function Log(msg)
{
  var obj = document.getElementById("log");
  obj.innerHTML = msg;
  obj.style.display = "";
}

var other_images_loaded = 0;

function ToggleMore()
{
   if (!other_images_loaded) {
       other_images_loaded = 1;
       Load_pic3(); Load_pic1();;
   }
   var obj = document.getElementById("t1");
   var but = document.getElementById("ShowMore");
   if (obj.style.visibility == 'hidden')
   {
        obj.style.visibility = 'visible';
        but.innerHTML = 'Other Photos Enabled (Click to Disable)';
   }
   else
   {
        obj.style.visibility = 'hidden';
        but.innerHTML = 'Click Here To Enable Other Photos';
   }
   HMOut(but);
}

function ShowMore()
{
   if (document.getElementById("t1").style.visibility == 'hidden')
     ToggleMore();
}

function ToggleCrops()
{
   var obj = document.getElementById("t2");
   var but = document.getElementById("ShowCrops");
   if (obj.style.visibility == 'hidden')
   {
        obj.style.visibility = 'visible';
        but.innerHTML = 'Crop Views Enabled (Click to Disable)';
   }
   else
   {
        obj.style.visibility = 'hidden';
        but.innerHTML = 'Click Here To Enable Crop Views';
   }
   HMOut(but);
}

function ShowCrops()
{
   if (document.getElementById("t2").style.visibility == 'hidden')
     ToggleCrops();
}

var but = new Array();

but[1] = document.getElementById('but1');
but[2] = document.getElementById('but2');
but[3] = document.getElementById('but3');
but[4] = document.getElementById('but4');
but[5] = document.getElementById('but5');
but[6] = document.getElementById('but6');
but[7] = document.getElementById('but7');
but[8] = document.getElementById('but8');
but[9] = document.getElementById('but9');

var pic = "";
var crop = "sm";
var num = 2;
var id = '';

function Update()
{
    var newid = pic + "_" + crop + "_img" + num;

    document.getElementById(newid).style.display = 'block';
    if (id != '')
        document.getElementById(id).style.display    = 'none';
    id = newid;

    document.getElementById('reset').style.visibility = (id == "pic2_sm_img1") ? 'hidden' : 'visible';

}

function Select(pic, crop, button)
{
    if (pic != "pic2")
        ShowMore();
    if (crop != "sm")
        ShowCrops();
    OnPic(pic);
    OnCrop(crop);
    OnButton(button);
    ClearNote();
}

function Reset()
{
    Select("pic2", "sm", 1);
}

function OnPic(name)
{
    if (pic != name)
    {
       if (pic != '')
          document.getElementById('bp_' + pic).className = 'xpb';
       document.getElementById('bp_' + name).className = 'pb';
       pic = name;
       Update();
    }
}

function OnCrop(name)
{
     crop = name;

     if (name != 'sm')
        document.getElementById('cb_sm').className = 'xcb';
     if (name != 'c1')
        document.getElementById('cb_c1').className = 'xcb';
     if (name != 'c2')
        document.getElementById('cb_c2').className = 'xcb';
     if (name != 'c3')
        document.getElementById('cb_c3').className = 'xcb';

     document.getElementById('cb_' + name).className = 'cb';
     Update();
}

function OnButton(newnum)
{
  if (newnum != num)
  {
      but[num].style.borderColor     = 'gray';
      but[num].style.color           = 'black';
      but[num].style.backgroundColor = '';

      num = newnum;
      Update();

      but[num].style.borderColor     = '#FF4040';
      but[num].style.backgroundColor = '#808080';
      but[num].style.color           = 'white';
  }
}

var note = '';

function ClearNote()
{
   if (note != '') {
       document.getElementById('shadow').style.visibility = 'hidden';
       document.getElementById(note).style.visibility = 'hidden';
       note = '';
   }
}

function ShowNote(name)
{
   ClearNote();
   note = name;
   document.getElementById('shadow').style.visibility = 'visible';
   document.getElementById(note).style.visibility = 'visible';
}

function ToggleNote(name)
{

   if (note == name)
       ClearNote();
   else
       ShowNote(name);
}

function Load_pic3() {
document.getElementById('img000').src = 'http://regex.info/i/raw/pic3/full-sm.jpg';
 document.getElementById('img001').src = 'http://regex.info/i/raw/pic3/comp-sm.jpg';
 document.getElementById('img002').src = 'http://regex.info/i/raw/pic3/diff_mask-sm.gif';
 document.getElementById('img003').src = 'http://regex.info/i/raw/pic3/diff_wide-sm.jpg';
 document.getElementById('img004').src = 'http://regex.info/i/raw/pic3/diff_raw-sm.jpg';
 document.getElementById('img005').src = 'http://regex.info/i/raw/pic3/full_bright-sm.jpg';
 document.getElementById('img006').src = 'http://regex.info/i/raw/pic3/comp_bright-sm.jpg';
 document.getElementById('img007').src = 'http://regex.info/i/raw/pic3/full_dark-sm.jpg';
 document.getElementById('img008').src = 'http://regex.info/i/raw/pic3/comp_dark-sm.jpg';
 document.getElementById('img009').src = 'http://regex.info/i/raw/pic3/full-c1.jpg';
 document.getElementById('img010').src = 'http://regex.info/i/raw/pic3/comp-c1.jpg';
 document.getElementById('img011').src = 'http://regex.info/i/raw/pic3/diff_mask-c1.gif';
 document.getElementById('img012').src = 'http://regex.info/i/raw/pic3/diff_wide-c1.jpg';
 document.getElementById('img013').src = 'http://regex.info/i/raw/pic3/diff_raw-c1.jpg';
 document.getElementById('img014').src = 'http://regex.info/i/raw/pic3/full_bright-c1.jpg';
 document.getElementById('img015').src = 'http://regex.info/i/raw/pic3/comp_bright-c1.jpg';
 document.getElementById('img016').src = 'http://regex.info/i/raw/pic3/full_dark-c1.jpg';
 document.getElementById('img017').src = 'http://regex.info/i/raw/pic3/comp_dark-c1.jpg';
 document.getElementById('img018').src = 'http://regex.info/i/raw/pic3/full-c2.jpg';
 document.getElementById('img019').src = 'http://regex.info/i/raw/pic3/comp-c2.jpg';
 document.getElementById('img020').src = 'http://regex.info/i/raw/pic3/diff_mask-c2.gif';
 document.getElementById('img021').src = 'http://regex.info/i/raw/pic3/diff_wide-c2.jpg';
 document.getElementById('img022').src = 'http://regex.info/i/raw/pic3/diff_raw-c2.jpg';
 document.getElementById('img023').src = 'http://regex.info/i/raw/pic3/full_bright-c2.jpg';
 document.getElementById('img024').src = 'http://regex.info/i/raw/pic3/comp_bright-c2.jpg';
 document.getElementById('img025').src = 'http://regex.info/i/raw/pic3/full_dark-c2.jpg';
 document.getElementById('img026').src = 'http://regex.info/i/raw/pic3/comp_dark-c2.jpg';
 document.getElementById('img027').src = 'http://regex.info/i/raw/pic3/full-c3.jpg';
 document.getElementById('img028').src = 'http://regex.info/i/raw/pic3/comp-c3.jpg';
 document.getElementById('img029').src = 'http://regex.info/i/raw/pic3/diff_mask-c3.gif';
 document.getElementById('img030').src = 'http://regex.info/i/raw/pic3/diff_wide-c3.jpg';
 document.getElementById('img031').src = 'http://regex.info/i/raw/pic3/diff_raw-c3.jpg';
 document.getElementById('img032').src = 'http://regex.info/i/raw/pic3/full_bright-c3.jpg';
 document.getElementById('img033').src = 'http://regex.info/i/raw/pic3/comp_bright-c3.jpg';
 document.getElementById('img034').src = 'http://regex.info/i/raw/pic3/full_dark-c3.jpg';
 document.getElementById('img035').src = 'http://regex.info/i/raw/pic3/comp_dark-c3.jpg';

}
 function Load_pic1() {
document.getElementById('img036').src = 'http://regex.info/i/raw/pic1/full-sm.jpg';
 document.getElementById('img037').src = 'http://regex.info/i/raw/pic1/comp-sm.jpg';
 document.getElementById('img038').src = 'http://regex.info/i/raw/pic1/diff_mask-sm.gif';
 document.getElementById('img039').src = 'http://regex.info/i/raw/pic1/diff_wide-sm.jpg';
 document.getElementById('img040').src = 'http://regex.info/i/raw/pic1/diff_raw-sm.jpg';
 document.getElementById('img041').src = 'http://regex.info/i/raw/pic1/full_bright-sm.jpg';
 document.getElementById('img042').src = 'http://regex.info/i/raw/pic1/comp_bright-sm.jpg';
 document.getElementById('img043').src = 'http://regex.info/i/raw/pic1/full_dark-sm.jpg';
 document.getElementById('img044').src = 'http://regex.info/i/raw/pic1/comp_dark-sm.jpg';
 document.getElementById('img045').src = 'http://regex.info/i/raw/pic1/full-c1.jpg';
 document.getElementById('img046').src = 'http://regex.info/i/raw/pic1/comp-c1.jpg';
 document.getElementById('img047').src = 'http://regex.info/i/raw/pic1/diff_mask-c1.gif';
 document.getElementById('img048').src = 'http://regex.info/i/raw/pic1/diff_wide-c1.jpg';
 document.getElementById('img049').src = 'http://regex.info/i/raw/pic1/diff_raw-c1.jpg';
 document.getElementById('img050').src = 'http://regex.info/i/raw/pic1/full_bright-c1.jpg';
 document.getElementById('img051').src = 'http://regex.info/i/raw/pic1/comp_bright-c1.jpg';
 document.getElementById('img052').src = 'http://regex.info/i/raw/pic1/full_dark-c1.jpg';
 document.getElementById('img053').src = 'http://regex.info/i/raw/pic1/comp_dark-c1.jpg';
 document.getElementById('img054').src = 'http://regex.info/i/raw/pic1/full-c2.jpg';
 document.getElementById('img055').src = 'http://regex.info/i/raw/pic1/comp-c2.jpg';
 document.getElementById('img056').src = 'http://regex.info/i/raw/pic1/diff_mask-c2.gif';
 document.getElementById('img057').src = 'http://regex.info/i/raw/pic1/diff_wide-c2.jpg';
 document.getElementById('img058').src = 'http://regex.info/i/raw/pic1/diff_raw-c2.jpg';
 document.getElementById('img059').src = 'http://regex.info/i/raw/pic1/full_bright-c2.jpg';
 document.getElementById('img060').src = 'http://regex.info/i/raw/pic1/comp_bright-c2.jpg';
 document.getElementById('img061').src = 'http://regex.info/i/raw/pic1/full_dark-c2.jpg';
 document.getElementById('img062').src = 'http://regex.info/i/raw/pic1/comp_dark-c2.jpg';
 document.getElementById('img063').src = 'http://regex.info/i/raw/pic1/full-c3.jpg';
 document.getElementById('img064').src = 'http://regex.info/i/raw/pic1/comp-c3.jpg';
 document.getElementById('img065').src = 'http://regex.info/i/raw/pic1/diff_mask-c3.gif';
 document.getElementById('img066').src = 'http://regex.info/i/raw/pic1/diff_wide-c3.jpg';
 document.getElementById('img067').src = 'http://regex.info/i/raw/pic1/diff_raw-c3.jpg';
 document.getElementById('img068').src = 'http://regex.info/i/raw/pic1/full_bright-c3.jpg';
 document.getElementById('img069').src = 'http://regex.info/i/raw/pic1/comp_bright-c3.jpg';
 document.getElementById('img070').src = 'http://regex.info/i/raw/pic1/full_dark-c3.jpg';
 document.getElementById('img071').src = 'http://regex.info/i/raw/pic1/comp_dark-c3.jpg';

}


Select("pic2", "sm", 1);



</script>
<p>

Let me stress again that the &#8220;exaggerated&#8221; version is <i>wildly</i>
exaggerated, both because the differences have been stretched to fill the
breadth of the 8-bit color space, and also because the differences are further
exaggerated (by a factor of 36!) by the way the size reduction was done.

</p><p>

It's instructive to see all these versions, masks, and differences at 100%
zoom. Click this button to enable several 100% crops in the mini
application above:

</p>

<center style='margin-top:10px'><span id='ShowCrops' class='prettybutton' onmouseover='HMOver(this)' onmouseout='HMOut(this)' onclick='ToggleCrops()'>Click Here To Enable Crop Views</span></center>

<p>While the reduced-size &#8220;Exaggerated&#8221; view might seem to show a lot of
detail has been lost, looking at the 100% crops shows that the actual
differences are much less, even though the exaggerated view is still wildly
exaggerated.</p>

<p><b>These Tests with Additional Pictures</b></p>

<p>

Playing around with the mini application above, you can see many different
views of the same picture (9 views for each of the four &#8220;crop&#8221;
buttons). All are derived from one shutter-release event.

</p><p>

In looking at these results, it's clear that the detail lost via
compression is extremely subtle, but perhaps this is only because my test
image doesn't have enough of the highlights that are susceptible to the
compression's lossiness. Perhaps I need to test with an exposure that has
more photons hitting the sensor?

</p><p>

With that in mind, I took another picture of the same scene, but this time
I purposefully overexposed it by two stops. To keep a balance to my tests,
I took one underexposed by two stops, as well.</p>

<p>It makes no sense to do pixel-by-pixel comparisons among these three
shots, as they're indeed different shots and subtle changes in lighting and
composition are likely much larger than any compression-related
differences. Still, each of the new pictures can be looked at,
individually, with the same attention to detail as the first. Click on the
this button to enable additional photos in the mini application above:</p>

<center style='margin-top:10px'><span id='ShowMore' class='prettybutton' onmouseover='HMOver(this)' onmouseout='HMOut(this)' onclick='ToggleMore()'>Click Here To Enable Other Photos</span></center>

<p>(Clicking on it has your browser download an additional 72 images
&mdash; 9 views for each of the four crops, per each of the two additional
pictures)</p>

<p>As additional confirmation that the loss of detail in <span
class='nef'>NEF</span> compression is in the highlights, select the
<b>Mask</b> view and cycle among the three photos: the over-exposed photo
has changes across the entire scene, while the under-exposed photo has
changes only in the brightest areas.

</p>
<p><b>Conclusions</b></p>
<p>

Consider the exaggerated view of the over-exposed photo (<span
onclick='Select("pic1", "sm", 4)' onmouseover='HMOver(this)'
onmouseout='HMOut(this)' style='text-decoration: underline'>click to
select</span>, then scroll up to view). Looking at this may lead one to
believe that a lot of detail has been lost. Clearly, much more has
been lost in this over-exposed shot than with the others, yet, the
differences still don't make it into any of the developed images, even at
100% crop. &#8220;More&#8221; is clearly relative.

</p><p>

Nevertheless, all the detail in the reduced-size exaggerated view is detail
that has been removed. Even though such detail may seem insignificant when
spread out over the entire 10.2 megapixel image, it <b>is</b> detail none
the less.

</p><p>

In the end, the only reason to use compression in the first place is for
convenience (smaller files, faster write times, and more images on a card),
and that convenience is paid for by irrevocable loss of image detail,
albeit a <i>very small amount</i> of image detail.

</p><p>

It's up to each photographer to determine whether the lost detail is at all
relevant. It is not relevant to me, so I enjoy the convenience of the
smaller, compressed files. However, if I were likely to have a lot of
over-exposed shots from which I absolutely had to extract the most
information possible, I might reconsider. (I'd probably continue to use
compression, but I'd have to at least reconsider.)

</p>
<hr/>
<p><b>Technical Details</b></p>

<p>Some notes about how I did the tests...</p>

<ul>

<li><p>The original compressed and uncompressed <span
class='nef'>NEF</span>s were converted to 16-bit &#8220;pseudo PPM&#8221;
files of raw, linear sensor data with no gamma and no whitebalance, using
David Coffin's most excellent <a
href='http://www.cybercom.net/~dcoffin/dcraw/'>dcraw</a>.</p></li>

<li><p>I wrote a program to compare the two PPMs and generate a new 16-bit
PPM representing only the per-pixel sensor-level differences, either as a
mask or as a &#8220;true differences&#8221; image.</p></li>

<li><p>The dark/mid/light versions were produced from each <span
class='nef'>NEF</span> (using dcraw) with different <b>-b</b> (brightness)
arguments.</p></li>

<li><p>The various jpeg versions of these files were created from PPM files
using ImageMagick's <a
href='http://www.imagemagick.org/script/convert.php'>convert</a>
utility.</p></li>

<li><p>The exaggerated versions were created using the <b>convert</b>
utility's <b>-normalize</b> argument.</p></li>

<li><p>I spent considerably more time building the javascript application
for showing the results than I spent generating the results.</p></li>

</ul>







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