Home > Enterprise >  Per-pixel logic in Photoshop
Per-pixel logic in Photoshop

Time:05-19

I have 2 images.

enter image description here enter image description here

I need to create a 3rd image, based on this logic:

If the pixel in image 1 and 2 is identical, the pixel in image 3 should be transparent.

If the pixel is different between image 1 and 2, use the pixel from image 1.

Photoshop blend modes don't seem to be the right direction. Are there any good 3rd party or scripting tools for this kind of operation?

CodePudding user response:

Pending a more clever solution, with Gimp:

  • Stack the images as layers
  • Fill the background of both images with white (bucket fill the whole layer in Behind mode)
  • Set top to Difference mode and create a layer with the result (Layer > New from visible)
  • Threshold the layer/ This is where you discover that your images are far from identical outside of the spear... (*). In an ideal world, you would threshold at "1" but here you have way too much noise, "20" seems a bare minimum)
  • Copy one of the RGB channels to a new channel
  • Make a copy of Image 1, and add a layer mask, initializing to the channel you copied.

enter image description here

(*) Here is the alpha channel of Image1: plenty of random not-so-transparent dots:

enter image description here

And Image2 is similar, with other random dots:

enter image description here

  • Related