1

Similar to this “Diff” an image using ImageMagick but lets say I have 2+ images of different sizes. Say from a game with multiple screenshots and I just want to extract the "coins" image so I detect it in a tool like Sikuli which accepts a transparent PNG and ignores the transparent areas.

I am thinking it is something with the compare tool to create a mask for one of the images then apply the mask using magick/convert to extract the final PNG.

Say I have three images where each are slightly off...

enter image description here enter image description here enter image description here

I want to somehow extract the following from the three images.

enter image description here

Note I am not really requiring a full imagemagick solution. I am thinking that the alignment best be done with another tool like Gimp, but I am not sure how to even create a "difference layer" that I can shift around so I can align the images.

Archimedes Trajano
  • 35,625
  • 19
  • 175
  • 265
  • Please explain further or show some examples. I do not understand what you want to do. – fmw42 Aug 07 '21 at 04:16
  • 1
    I do not see any automatic easy way to find a common area when they are not aligned. If you know you want the red area and there are no other red areas, you can threshold on red, then use connected components to extract the bounding boxes in each image. – fmw42 Aug 07 '21 at 15:06
  • 1
    You could try sliding one image across all possible locations of the other and differencing them at each location then look for black locations - i.e. where the difference is zero. It will be slow and inefficient so you may want to reduce the image sizes first to speed it up. https://stackoverflow.com/a/53391124/2836621 and https://stackoverflow.com/a/27342865/2836621 – Mark Setchell Aug 07 '21 at 15:15
  • @MarkSetchell yah I didn't think it was something trivial or even possible with image magick from what I saw. There needs to be some form of "human" to do this work on Gimp/Photoshop. Sort of making a difference layer and shifting that around manually. I'll update the OP to indicate that magick is not required, – Archimedes Trajano Aug 07 '21 at 17:46

0 Answers0