【发布时间】:2017-05-18 05:58:51
【问题描述】:
我在这里尝试使用 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
如果有人以前使用过这个或知道如何将输出作为图像输出到 out.jpg 中,请告诉我。
我还使用 print() 检查了 script_response,但它给了我 textcleaner 的帮助菜单。
【问题讨论】:
-
您的第一个错误是 bash 脚本而不是 php 代码。
-
你能告诉我如何在我的python程序中执行它