AlexLN wrote:Sorry, as I said I'm pretty nooby, i just wondering is there a no ready solution for such applied task as transfer of value of a variable for Windows users, because I did not find it in the manual.
Getting the output of a command into a variable in Windows is not a very simple task. I'm running ImageMagick 6.9.3-1 Q16 x64 on Windows 7 64, and I've made a batch file like the one below that does what you want. Copy and paste this into your text editor (Notepad, etc.) and save it as something like "imcompare.bat".
Code: Select all
@echo off
setlocal
set IMG1=%~1
set IMG2=%~2
for /F "tokens=2 delims=() " %%A in ( 'compare -metric MAE "%IMG1%" "%IMG2%" null: 2^>^&1' ) do (
if %%A LSS 0.003 (
echo Same
) else (
echo Different
)
)
Then run it from the command line like this...
Code: Select all
imcompare.bat image1.jpg image2.jpg
If your IM "compare.exe" command isn't already in the PATH, you may need to use its full path in your script. If the script isn't in your path or in the current directory, you may need to call it by using its full path. If the image files you're comparing aren't in the current working directory, you may need to call them by their full paths.
The actual workings of the batch file may be outside the scope of this forum. You'll probably get more helpful and detailed answers at a forum about using Windows commands and scripts. Maybe find some pointers about passing arguments to a Windows batch file by studying
this page, and learn more about using "for" to get the output of a command into a variable by studying
this page.