use Python to call ImageMagick's “import”

假装没事ソ 提交于 2019-12-13 04:07:12

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!