Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How to find out the pixel values

New Here ,
Jul 28, 2009 Jul 28, 2009

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

TOPICS
Actions and scripting
1.1K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Guru ,
Jul 28, 2009 Jul 28, 2009
LATEST

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();

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines