Skip to main content
Participant
June 14, 2017
Question

How to change pixel color with javascript in Photoshop?

  • June 14, 2017
  • 1 reply
  • 2374 views

I have layer in Photoshop where with brush is drawn something. I need to read this layer pixel for instance pixel with coordinates (100,100) and write to new layer this pixel with changed pixel color. How to do it with javascript? I use Photoshop CC.

This topic has been closed for replies.

1 reply

SuperMerlin
Inspiring
June 14, 2017

#target photoshop;

if(documents.length){

var Left = 100;

var Right = 101;

var Top = 100;

var Bottom = 101;

var fillColour = new SolidColor();

fillColour.rgb.hexValue="00ff00";

activeDocument.selection.select([[Left,Top],[Right,Top],[Right,Bottom],[Left,Bottom]], SelectionType.REPLACE, 0, false);

executeAction(charIDToTypeID( "CpTL" ), undefined, DialogModes.NO );

activeDocument.selection.select([[Left,Top],[Right,Top],[Right,Bottom],[Left,Bottom]], SelectionType.REPLACE, 0, false);

activeDocument.selection.fill(fillColour);

activeDocument.selection.deselect();

}