Hi
How can I combine these two imagemagick command into one. I want to compare two images by columns. I thing I'am wasting too much time to write results to a disk.
set /a "width = 1600"
set /a "height = 1200"
set /a "column = 5"
set /a "x = 0"
:while1
if %x% < %width% (
set /a "x = x + %column%"
convert sample.mpc -crop %column%x%height%+%x%+0 sample/cropped%x%.mpc
convert test.mpc -crop %column%x%height%+%x%+0 test/cropped%x%.mpc
compare -metric AE -fuzz 2%% sample/cropped%x%.mpc test/cropped%x%.mpc null 2>>differences.txt
goto :while1
)
Thank you so much for your help!
combining commands
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: combining commands
You can combine these three ...
... into one convert. (Windows BAT syntax, untested.)
(Untested.)
A "for" loop is probably quicker than "goto".
The loop could create a script file that builds just one convert command that reads sample.mpc and test.mpc just once, then does multiple crops (on clones) and comparisons. That would be massively quicker.
Code: Select all
convert sample.mpc -crop %column%x%height%+%x%+0 sample/cropped%x%.mpc
convert test.mpc -crop %column%x%height%+%x%+0 test/cropped%x%.mpc
compare -metric AE -fuzz 2%% sample/cropped%x%.mpc test/cropped%x%.mpc null 2>>differences.txt
Code: Select all
convert ^
( sample.mpc -crop %column%x%height%+%x%+0 ) ^
( test.mpc -crop %column%x%height%+%x%+0 ) ^
-metric AE ^
-compare ^
-format %%[distortion] ^
info: >>differences.txt
A "for" loop is probably quicker than "goto".
The loop could create a script file that builds just one convert command that reads sample.mpc and test.mpc just once, then does multiple crops (on clones) and comparisons. That would be massively quicker.
snibgo's IM pages: im.snibgo.com
Re: combining commands
Thank you very much!
I'am going to try it out.
I'am going to try it out.
Re: combining commands
not working...
Re: combining commands
I cant do this without writing converted images to disk.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: combining commands
Do you get any error messages? What is "not working"? What version IM are you on? If it is old, "convert" may not have the "-compare" operator. In that case, as you care only about how many pixels are different, you can "-compose Difference -composite" and change non-black into white and find the mean. This gives the proportion of pixels that are different. Multiply by W*H to get the number that have changed.
snibgo's IM pages: im.snibgo.com
Re: combining commands
It's OK! You syntax is working.
I did make a mistake
Thank you one more time!
I did make a mistake
Thank you one more time!