I'm fairly new to python, but have a fair amount of experience with other languages. I wonder if anyone can help.
The Problem I'm trying to incorporate the comparison of two images (using ImageMagicks compare.exe) and then make a decision based on the output.
I'm hitting problems, because I can't seem to pull the output from compare.exe into my own code.
Running my command at the command line, I get the required metric of difference:
C:\usr\local\bin\att>compare -metric AE -fuzz 2000 1.png 2.png diff.png
8772
C:\usr\local\bin\att>_
The problem is if I try and pipe this to a text file:
C:\usr\local\bin\att>compare -metric AE -fuzz 2000 1.png 2.png diff.png > tmp.txt
8772
The metric is still displayed at the console, and not written to the text file.
Following on the only success I've had using python is to delay the output, but I still can't capture it to a variable.
Doing:
myOutput=subprocess.Popen("C:\\usr\\local\\bin\\att\\compare.exe -metric AE -fuzz 100 1.png 2.png mask.png", stdout=subprocess.PIPE)
will not display '8772' to the console until I then call:
line = myOutput.stdout.readline()
when it will be written to console output, but my variable will be NULL.
Can anyone please help with this, or dose anyone have any clue why this is happening?
Cheers,
Nathan.