Well, this is only for test. It use object masic. If the image size(pixels) is bigger than 30*30 or 50*50, it will become very slow. Note: the image should be 72 dpi. So step 1: make sure image is 72 dpi, if not, reset it(this can be done with script); step 2: crop(not clip) the image to size like 10*10 px (contain the given pixel of cause. Not sure this can be done with script or not.) Anyway, here is the code. String.prototype.formatUnicorn = function() { "use strict"; var str = this.toString(); if (arguments.length) { var t = typeof arguments[0]; var key; var args = ("string" === t || "number" === t) ? Array.prototype.slice.call(arguments) : arguments[0]; for (key in args) { str = str.replace(new RegExp("\\{" + key + "\\}", "gi"), args[key]); } } return str; }; function objectMasic(w, h) { var actionStr = ''' /name [ 1 73] /actionCount 1 /action-1 { /name [ 1 61] /eventCount 1 /event-1 { /internalName (ai_plugin_mosaic) /hasDialog 1 /showDialog 0 /parameterCount 7 /parameter-1 { /key 1937208424 /type (integer) /value 0 } /parameter-2 { /key 1936222068 /type (integer) /value 0 } /parameter-3 { /key 1953985640 /type (integer) /value {width} } /parameter-4 { /key 1952999284 /type (integer) /value {height} } /parameter-5 { /key 1668246642 /type (boolean) /value 1 } /parameter-6 { /key 1684368500 /type (boolean) /value 0 } /parameter-7 { /key 1886544756 /type (boolean) /value 0 } } } '''.formatUnicorn({width:w, height:h}); createAction(actionStr, 's'); app.doScript('a', 's'); app.unloadAction('s', ''); } function createAction(str, set) { var f = File(set + '.aia'); f.open('w'); f.write(str); f.close(); app.loadAction(f); f.remove(); } function getPixel(image, x, y) { var h = image.height.toFixed(0), w = image.width.toFixed(0); objectMasic(w, h); return app.selection[0].pathItems[w * (y - 1) + x - 1].fillColor } var color = getPixel(app.selection[0], 3, 3); alert([color.cyan, color.magenta, color.yellow, color.black].join(', ')); app.selection[0].remove();
... View more