photoshop - Is it possible to read a pixel of an image in JavaScript? -


i have bunch of photos have badges on them, close 1500 of them, need way detect if there yellow badge on it. possible make action or script color sample exact pixel coordinate every time , if finds color represents badge send particular folder, grouped other jpegs found have badge. thoughts or opinions on helpful?

i know old since tagged in photoshop (and can done in photoshop javascript), here solution:

#target photoshop  // test function  function hasbadge(doc, x, y) {      // remove current color samplers because photoshop has limit of 4 or , create new sampler @ coordinates     (var i=0; i<doc.colorsamplers.length; i++) {         doc.colorsamplers[i].remove();     }     var sampler = doc.colorsamplers.add([x, y]);      //this tricky based on actual color of badge. if badge consistently same exact color test it's hexvalue...     if (sampler.color.rgb.hexvalue === "ffff00") {         return true;     }      // if color not consistent can try test if it's within range of rgb values. may take tweaking...     if (sampler.color.rgb.red > 200 && sampler.color.rgb.green > 200 && sampler.color.rgb.blue < 50) {         return true;     }      return false; }  // program  var x = 200; var y = 200;  // process entire folder. can use file.opendlg() select files might easier select folder if have ton of files var inputfolder = folder.selectdialog("select folder process"); var filelist = inputfolder.getfiles("*.jpg"); //use whatever extension want or no extension select files  // each file in folder... for(var i=0; i<filelist.length; i++) {      var doc = open(filelist[i]);      if (hasbadge(doc, x, y) {         doc.saveas(new file("c:/my/file/path/" + doc.name));         doc.close(saveoptions.donotsavechanges);     } } 

Comments