Which gives the most accurate ICC color profile transformation? Photoshop CS2 or PI Core?
Fair warning - I am not a mathematician - feel free to tell me where I'm wrong! Also, there are five questions at the very bottom of this rather long post.
1)Linear and gamma = 1.8 ProPhoto working spaces:
Mathematically the conversion from a gamma = 1.8 space to a gamma = 1 space is a straightforward and totally lossless transformation, using the following conversion equation:
rgb# divided by 255 (to normalize, assuming 8-bit file - use other value as appropriate), result raised to the 1.8 power, then multiplied by 255 (or other value as appropriate).
And to get back from gamma 1.8 space to gamma 1.0 space would involve going the other way, and again, the transformation should be totally lossless.
In Photoshop CS2 I created a "linear ProPhoto, gamma = 1.0" working space by opening up the PS "Color Settings" dialog, selecting ProPhoto as the RGB Working Space, then selecting "Custom", which brings up the ProPhoto color space information. Then I changed the gamma from 1.8 to 1.0 and saved the resulting color space as "linear ProPhoto".
The 16-bit ProPhoto tiff that ACR 3.7 produces after converting a raw file is in the standard Adobe gamma = 1.8 ProPhoto working space (assuming you choose ProPhoto rather than sRGB for output from ACR). The whole point of this exercise is I would like the option of working in a gamma=1 working space, without paying a heavy "conversion" penalty of loss of information by doing what OUGHT to be a lossless operation.
2)Photoshop conversion from gamma 1.8 to gamma 1 and back shows gapping:
The problem with using Photoshop to convert from gamma 1.8 space to gamma 1.0 space and back to gamma 1.8 space is that the histogram of the resulting file demonstrates gapping and combing - information has been lost, probably because Photoshop actually uses 15-bit integer math rather than true 16-bit floating point math. The gapping and combing is evident regardless of which "engine" or "intent" is used and whether or not "black point compensation" is used. The "use dither" option would eliminate the banding, but that is cheating, as "use dither" randomizes the last significant decimal point (probably not phrased right) of information for the precise purpose of eliminating banding - thus guaranteeing a less accurate though bandless and combless conversion.
The Photoshop histogram shows the loss after the above-described double conversion. But to really see the loss, use the Reindeer Graphics Optipix Wide Histogram plug-in, available at
http://www.reindeergraphics.com/index.php?option=com_content&task=view&id=31&Itemid=54.
So can PixInsight Core be used to create a more accurate, less "lossy" conversion from a gamma = 1.8 space to a gamma = 1.0 space and then back again?
3)Comparing results from using PS and PI Core to do ICC profile transforms:
Working strictly in 16 bits, and starting with the same 16-bit ProPhoto gamma = 1.8 file, I made conversions to linear ProPhoto and back to gamma 1.8 ProPhoto, using Photoshop CS2 and using PI Core - seeking the particular combination of intent, bit-depth, floating (for PI Core) or not floating (for Photoshop), and with or without black point compensation - that would give the most accurate round-trip conversion.
I eliminated "black point compensation" from further testing, because PI Core consistently completely chokes up the shadows when the option "black point compensation" is used. As "use black point compensation" is supposed to eliminate rather than produce choked up shadows, there seems to be a problem with the PI Core implementation of "use black point compensation". For Photoshop, the "use black point compensation" option, at least for the conversion into and back out of linear ProPhoto working space, made no visible difference in the shadow areas of the resulting tiff. I used the Adobe conversion engine in PS, as previous testing within PS CS2 had shown no visible difference in the final tiff when using the Microsoft engine instead of the Adobe engine.
All test tiff conversions began with the same 16-bit gamma 1.8 ProPhoto output from ACR 3.7. And for my initial testing, all files were saved as 16-bit files, with no interim conversion to 32-bits. My final set of converted test tiffs included:
Photoshop conversions from gamma 1.8 to gamma 1, and back to gamma 1.8, using relative colorimentric, absolute colorimetric, and perceptual (three test tiffs). plus
PI Core conversions from gamma 1.8 to gamma 1, and back to gamma 1.8, using relative colorimetric, absolute colorimetric, and perceptual (three more test tiffs, for a total of 6).
All six test tiffs, plus the original 16-bit tiff created by ACR 3.7, were pulled into a Photoshop *.PSD file as layers. I then used the Photoshop color sampler tool to take spot color sample RGB readings (four at a time, that being the Photoshop CS2 limit for the number of simultaneous color samples). I took a total of 24 readings. The first four readings were enough to show that the most accurate conversion by Photoshop was from using perceptual rendering intent. And the most accurate conversion by PI core was from using relative colorimetric rendering intent (with floating point math - I didn't try unchecking the floating point option).
Of the 72 individual channel readings from my 24 test color samples, Photoshop perceptual had 5 errors and PI Core relative colorimetric had 0 errors.
More important than the number of errors (which were really taken as a way of confirming the following observation) was the fact that the Reindeer Graphics Wide Histogram showed significantly less combing and banding for the PI Core transformed tiff, than for the Photoshop transformed tiff, when comparing the PS perceptual rendering to the PI Core relative colorimetric rendering.
The obvious conclusion is that if someone wants to work in a linear (gamma = 1) working space and is starting with a file that was created with a gamma>1 ICC profile, PI Core will create a more accurate ICC profile conversion than Photoshop CS2.
4)32-bit interim conversion?
Now what about an interim conversion from 16-bit to 32-bit for the original file, with all subsequent conversions being done in 32-bit floating? Can't be done in Photoshop, other than the original conversion to 32-bit. I converted my original 16-bit test file to 32 bits in Photoshop and saved as "floating" (Photoshop and PI cannot read each other's respective "32-bit integer" files). I opened the file in PI Core and converted to linear ProPhoto and saved as a 32-bit floating point tiff. I then converted the linear ProPhoto tiff back to gamma 1.8 ProPhoto and saved the file as a 32-bit floating point tiff. Photoshop opened both 32-bit PixInsight-produced tiffs, but it displayed the second tiff, the tiff that had gone from gamma 1.8 to gamma 1, to gamma 1.8 incorrectly, showing very washed out colors, like what you'd expect if a gamma 1.8 profile had been assigned to a gamma 1.0 file. I went back into PI and saved the same file as a 16-bit tiff, and Photoshop opened and displayed it correctly.
I did a spot check on four color sample points on the file with the interim 32-bit conversions - they matched the original file. But I didn't feel like checking more points.
The "acid test" of ICC profile transform accuracy is to transform the "
www.brucelindbloom.com/RGB16Million.html" tiff. I did so, using 32-bit processing as far as possible, and using relative colorimetric floating no black point compensation for PI core and perceptual no black point compensation for Photoshop. Both round-trip transformations showed the resulting histogram "cut in half" as shown by the Photoshop histogram. The Wide Histogram showed the shadow areas comby for Photoshop, and several random spots of slight combiness for PI. I couldn't find any inaccurate color samples for either, but I didn't try very hard.
5)Questions
I have some questions regarding PI Core's ICC profile transform function.
First, which set of parameters - bit-depth, rendering intent, use or don't use black point compensation, bit depth for saving - OUGHT to give the most accurate ICC profile transform, assuming that the transform in question is merely going from one gamma to another, rather tthan going from say, ProPhoto to WideGamut?
Second, is there any mathematical accuracy to be gained (or lost?) by doing an interim conversion to 32 bits?
Third, why does Photoshop display the second conversion, saved in 32 bit floating, incorrectly (washed out, lightened, like it is using the a profile with the wrong gamma), when it correctly displays the first conversion, also saved in 32 bit floating. A Photoshop problem? a PI problem? Or user error on my part?
Fourth, why the choked up shadows when using black point compensation with PI Core?
And finally, does PI Core use dithering or some such equivalent? Or is the histogram from PI core really showing a better, more accurate, less lossy ICC profile transformation?
Thanks! for responding
Elle