I'm working on some digital imaging & color management research using Photoshop, and I'd like to optimize my speed and accuracy. I'm aware of some command line tools like imagemagick, but since we are working with custom profiles and our end users will be using Photoshop, I'd like to stay within the Adobe CMM ecosystem to ensure that our testing reflects the real world usage.
I'm working with high-res 16-bit RGB and Lab files- I'm interested in gathering data from images of ColorChecker SG target cards. I've tried scripting two ways to read target color information:
- Color Samplers
- Pros: Accurate 16 (aka "15+1") bit readout of color. Lab values with decimal precision.
- Cons: Each color sampler is only a point sample. I've scripted out creating an average readout of various pixels, but it is slow.
- Checking one point sample/square gives an inaccurate result, takes only about 30 seconds
- Checking/averaging a 3x3px area takes 13 seconds/square X 140 squares on the chart (~30 mins/chart)
- Checking/averaging a 50x50px area takes 400 seconds/square X 140 squares (~15 hours/chart)
- There is an average ∆E of 0.26 between the 3x3 and 50x50 readings, indicating that more is better, but 50x50 is probably overkill. However I'm looking to be able to process multiple charts daily, so even if the 3x3 was accurate enough, it would still be slower than I'd like.
- Histogram
- Pros: Fast. Takes 30 seconds to read 140 patches, averaging an area of 50x50px per reading
- Cons: The histogram data is only 8 bits, even for a 16 bit original. Less accurate recording of color data.
- Comparing the histogram data to the 50x50 color sampler data yields an average ∆E = .753, min ∆E = .56, max ∆E = .99
So really, I'd like the speed of the histrogram matched with the accuracy of the 16 bit color sampler... Any thoughts? I'm currently using AppleScript because I find it easier to get things up and running, though js is a possiblity.
Here's a snippet of code from the Color Sampler way- I think it's pretty lean code while it loops here, but perhaps there's something that could speed it up?
repeatsampleSizetimes
repeatsampleSizetimes
tellcurrent document
settheSamplertomakenewcolor samplerwith properties {class:color sampler, position:{currentX, currentY}}
settheValuestocolor sampler coloroftheSampler
deletetheSampler
endtell
setvalueLsumtovalueLsum + (value_LoftheValues)
setvalueAsumtovalueAsum + (value_aoftheValues)
setvalueBsumtovalueBsum + (value_boftheValues)
setcurrentXtocurrentX + 1
endrepeat
setcurrentXtocurrentX - sampleSize
setcurrentYtocurrentY + 1
endrepeat