Page 1 of 1

Compare in ImageMagick

Posted: Thu Oct 09, 2014 5:13 pm
by _olq
Hi all,



Is there a possibility to use the tool 'compare' contained in the 'ImageMagick' through Switch tool 'Execute command'? I did some tests with the command line and it works well.

I don't know how to indicate two input files to be able perform the operation.

I would like to make it like this:

'Input folder (with files to compare)' -> compare -> output folder (with file comparison)





Thanks in advance,

Aleksander

Compare in ImageMagick

Posted: Thu Oct 09, 2014 5:50 pm
by gabrielp
_olq wrote: I don't know how to indicate two input files to be able perform the operation.


I don't know much about ImageMagick apart from using the PHP library. But if you figure out how to specify the input files in command line, you could probably define some temporary files (or static ones on your filesystem) using the File class. Once those temporary paths are tied to a variable, I imagine you could pass that into ImageMagick. Hope that helps

Compare in ImageMagick

Posted: Mon Oct 13, 2014 11:39 am
by _olq
gabrielp wrote: you could probably define some temporary files (or static ones on your filesystem) using the File class. Once those temporary paths are tied to a variable, I imagine you could pass that into ImageMagick.


Hi Gabriel,

What you say makes sense, but I have no idea how to do it :)

Could you show an example?

Compare in ImageMagick

Posted: Mon Oct 13, 2014 3:00 pm
by dkelly
I wrote this configurator for Imagemagick's compare



https://www.dropbox.com/s/dihwpwv8d48ah ... cript?dl=0



Dwight Kelly

Apago, Inc.

Compare in ImageMagick

Posted: Tue Oct 14, 2014 10:21 am
by _olq
I'm pleasantly surprised, it works great.

Good job Dwight, thank you very much!

Compare in ImageMagick

Posted: Tue Oct 14, 2014 10:57 am
by _olq
Maybe just one little question :)

Where should I add options to compare command?

Compare in ImageMagick

Posted: Tue Oct 14, 2014 3:28 pm
by dkelly
Edit the script, find the lines that start with argv[argc++] and add or modify options.

Compare in ImageMagick

Posted: Wed Oct 15, 2014 10:16 am
by _olq
Thanks again Dwight,

I have some trouble with that.

When I'm adding an option with the existing I have error "Failed to run external process"





args[argc++] = appPath+" -metric AE -fuzz 5%";

args[argc++] = job.getPath()+"/"+entries[0];

args[argc++] = job.getPath()+"/"+entries[1];

args[argc++] = differenceFN;





If I'm adding separate, option has no effect





args[argc++] = appPath;

args[argc++] = " -metric AE -fuzz 5%";

args[argc++] = job.getPath()+"/"+entries[0];

args[argc++] = job.getPath()+"/"+entries[1];

args[argc++] = differenceFN;





Do you have any idea?

Compare in ImageMagick

Posted: Wed Oct 15, 2014 3:37 pm
by dkelly
Follow the pattern that is already there for arguments



args[argc++] = appPath;

args[argc++] = "-metric"; args[argc++] = "AE";

args[argc++] = "-fuzz"; args[argc++] = "5%";

args[argc++] = job.getPath()+"/"+entries[0];

args[argc++] = job.getPath()+"/"+entries[1];

args[argc++] = differenceFN;

Compare in ImageMagick

Posted: Wed Oct 15, 2014 5:41 pm
by _olq
So, it was reason :)

Of course works correctly.



Big thanks again!