Copy link to clipboard
Copied
Is it possible to find out the every pixel color values(percentage) for CMYK files in photoshop through scripting. Kindly advise me the possibilities and solution.
Thanks
Copy link to clipboard
Copied
It is possible, but most people find it too slow to be of much use. Below is an example of how to check Total Ink in a doc.
app.activeDocument.colorSamplers.removeAll();
var inkLimit = 300;
var xPos = new UnitValue( 0.5,'px') ;
var yPos = new UnitValue( 0.5,'px' );
var pixPos = [ xPos, yPos ];
var step = new UnitValue( .5, 'px' );
var mySampler = app.activeDocument.colorSamplers.add( pixPos );
var w = app.activeDocument.width.as( 'px' );
var h = app.activeDocument.height.as( 'px' );
for(x = 0; x < w - 1; x++) {
for(y = 0; y < h - 1; y++){
pixPos = [ new UnitValue( x, 'px' ) + step, new UnitValue( y, 'px' ) + step ];
mySampler.move( pixPos );
var myColor = mySampler.color;
var cyan = myColor.cmyk.cyan;
var yellow = myColor.cmyk.yellow;
var magenta = myColor.cmyk.magenta;
var black = myColor.cmyk.black;
var totalInk = cyan + yellow + magenta + black;
if( totalInk >= inkLimit ) {
alert('Over limit pixel found at ' + pixPos + '\nTotal ink amout = ' + totalInk );
}
}
}
app.activeDocument.colorSamplers.removeAll();
Find more inspiration, events, and resources on the new Adobe Community
Explore Now