问题
I want to capture a screenshot of an application's window from a Python script using ImageMagick, as I would with ImageMagick's "import" command from a shell. An API call or a system call from Python (as in "subprocess.Popen(["import"...") will suffice, but I don't want to create a file on the hard drive. My OS is Linux.
回答1:
Execute the command:
import png:-
This will cause import to output to stdout.
You can also change png to one of the type tags shown here.
来源:https://stackoverflow.com/questions/4590088/use-python-to-call-imagemagicks-import