2 votes
Accepted

Is it possible to write a script in Photoshop that reads the values of a pixel on two layers, then sets a new value in the layer mask of a third?

Not asked, but after replacing your complex variable names with B (=pixel from Layer1) and A (=pixel from layer2) your K will have equation K=Round(100(1-(B-A)/B). It reduces in elementary math to K=...
user avatar
  • 51.6k

Only top scored, non community-wiki answers of a minimum length are eligible