I’m trying to take a screenshot then run a command on that screenshot without saving to disk.
The actual command I want to run is visgrep image.png pattern.pat
visgrep must have two args: the image file and a .pat file.
Here is what I have so far.
p = subprocess.Popen(['import', '-crop', '305x42+1328+281', '-window', 'root', '-depth', '8', 'png:' ], stdout=subprocess.PIPE,)
cmd = ['visgrep']
subprocess.call(cmd, stdin=p.stdout)
Obviously this fails as visgrep must have two args.
So how can I do visgrep image.png pattern.pat but substituting ‘image.png’ with the output of ImageMagick’s import?
Do I need to use xargs? Is there a better way to accomplish what I’m trying?
In linux you can use
/dev/stdinas file name but it does not work all the times. If it does not work withvisgrep, you must use a temporary file (which is not a shame).PS. shouldn’t
png:bepng:-?