在这里,我尝试使用php脚本textcleaner处理一个图像。我必须在python项目的另一部分中运行这个php脚本。我对从php脚本textcleaner获取输出图像感到困惑(我从这里获取这个脚本:
http://www.fmwconcepts.com/imagemagick/textcleaner/index.php )你知道吗
我在python中运行它的代码是。。你知道吗
import subprocess
proc = subprocess.Popen("php textcleaner.php -g -e none -f 10 -o 5 src.jpg out.jpg", shell=True, stdout=subprocess.PIPE)
script_response = proc.stdout.read()
这里textcleaner.php
是php脚本文件,之后(-g -e none -f 10 -o 5
)
是我要传递给脚本(textcleaner)的参数,用于处理图像(src.jpg
),输出图像应该是out.jpg
如果有人以前用过这个或者知道如何得到输出输出.jpg作为一个形象,请告诉我。你知道吗
我还使用print()检查了script\u response,但它提供了textcleaner的帮助菜单。你知道吗
这个答案Running bash script from within python可能会为您指明正确的方向-我不使用Python或bash,因此无法进一步帮助您。你知道吗
不要忘记使textcleaner可执行,例如777或755可以工作。我会把textcleaner重命名为文本清理器.sh使用文本清理器.sh在你的代码里。它只是提醒您文件类型是什么。你知道吗
相关问题 更多 >
编程相关推荐