found this somewhere:
//////////////////
var pixelColor = getPixelColor(100,100); // the two values are the horizontal and vertical position of the pixel you want the color from function getPixelColor(pixH,pixV){ // this only works for an active RGB document
var selRegion = null;
selRegion = Array(Array(pixH, pixV),
Array(pixH + 1, pixV),
Array(pixH + 1, pixV + 1),
Array(pixH, pixV + 1),
Array(pixH, pixV));
var currDoc = app.activeDocument;
currDoc.selection.select(selRegion);
var histR = currDoc.channels.getByName("Red").histogram; var histG = currDoc.channels.getByName("Green").histogram; var histB = currDoc.channels.getByName("Blue").histogram; var returnColor = new RGBColor();
for (iHistR in histR){
if(histR[iHistR]!=0){
returnColor.red = iHistR;
}
}
for (iHistG in histG){
if(histG[iHistG]!=0){
returnColor.green = iHistG;
}
}
for (iHistB in histB){
if(histB[iHistB]!=0){
returnColor.blue = iHistB;
}
}
return returnColor;
}
alert(pixelColor.hexValue+"\n"+pixelColor.red+","+pixelColor.green+ ","+pixel
Color.blue);
/////////////////////
and to fill that with new color:
var color = new SolidColor();
color.rgb["hexValue"] = "00ff00";
currDoc.selection.fill(color);
R
"Hitchkas" wrote in message
How one accesses individual pixels of an image in Javascript for PhotoShop? For example is there a method that allows something like the following?
//x, and y pixel coordinates along width and height of image Image.Channel.Red(x, y) = 128;
Namely, how one can read and write an individual pixel value of an image?