Compare in ImageMagick

Post Reply
_olq
Member
Posts: 36
Joined: Fri Aug 23, 2013 10:21 am
Location: Poland

Compare in ImageMagick

Post 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
Aleksander
User avatar
gabrielp
Advanced member
Posts: 577
Joined: Fri Aug 08, 2014 4:31 pm
Location: Boston
Contact:

Compare in ImageMagick

Post 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
Chat: open-automation @ gitter
Code: open-automation & dominickp @ GitHub
Tools: Switch, Pitstop, EPMS, Veracore, PageDNA, SmartStream, Metrix
_olq
Member
Posts: 36
Joined: Fri Aug 23, 2013 10:21 am
Location: Poland

Compare in ImageMagick

Post 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?
Aleksander
dkelly
TOP CONTRIBUTOR
Posts: 628
Joined: Mon Nov 29, 2010 8:45 pm
Location: Alpharetta GA USA
Contact:

Compare in ImageMagick

Post by dkelly »

I wrote this configurator for Imagemagick's compare



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



Dwight Kelly

Apago, Inc.
_olq
Member
Posts: 36
Joined: Fri Aug 23, 2013 10:21 am
Location: Poland

Compare in ImageMagick

Post by _olq »

I'm pleasantly surprised, it works great.

Good job Dwight, thank you very much!
Aleksander
_olq
Member
Posts: 36
Joined: Fri Aug 23, 2013 10:21 am
Location: Poland

Compare in ImageMagick

Post by _olq »

Maybe just one little question :)

Where should I add options to compare command?
Aleksander
dkelly
TOP CONTRIBUTOR
Posts: 628
Joined: Mon Nov 29, 2010 8:45 pm
Location: Alpharetta GA USA
Contact:

Compare in ImageMagick

Post by dkelly »

Edit the script, find the lines that start with argv[argc++] and add or modify options.
_olq
Member
Posts: 36
Joined: Fri Aug 23, 2013 10:21 am
Location: Poland

Compare in ImageMagick

Post 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?
Aleksander
dkelly
TOP CONTRIBUTOR
Posts: 628
Joined: Mon Nov 29, 2010 8:45 pm
Location: Alpharetta GA USA
Contact:

Compare in ImageMagick

Post 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;
_olq
Member
Posts: 36
Joined: Fri Aug 23, 2013 10:21 am
Location: Poland

Compare in ImageMagick

Post by _olq »

So, it was reason :)

Of course works correctly.



Big thanks again!
Aleksander
Post Reply