Page 1 of 1

Unable to get -subimage-search to work

Posted: 2020-03-24T14:47:02-07:00
by Xyresic
I been trying for the past few hours trying to get subimage-search to work, and at this point I'm convinced there's something broken with imagemagick. Admittingly, I am using WSL on Windows, but I've also tried the Windows binaries (the v7 binaries though, instead of the default v6 from the package manager in WSL Ubuntu) and that gave the same error.

Even trying to follow something as simple as this post isn't working: https://stackoverflow.com/questions/318 ... ux-console

This is what I see when I try that:

Image

I'm pretty sure there's nothing wrong with the images I'm using, but here they are anyways:

Image

Image

Anyone have any ideas what's wrong here?

Re: Unable to get -subimage-search to work

Posted: 2020-03-24T14:58:07-07:00
by fmw42
You need special processing for compare when using transparency. You need to separate the alpha channel from the reference (small) image and use it as a mask on the opaque version of the reference. The command is different also. But it only works in IM 7. See https://imagemagick.org/discourse-serve ... =4&t=31053

P.S. IM 6.9.7.4 is ancient (over 3 years old and many versions and enhancements). Time to upgrade.

Re: Unable to get -subimage-search to work

Posted: 2020-03-24T17:10:07-07:00
by snibgo
Xyresic wrote: compare.exe: images too dissimilar `haystack.png' @ error/compare.c/CompareImageCommand/1170.
For that problem, use "-dissimilarity-threshold 1". See https://www.imagemagick.org/script/comm ... -threshold