简体   繁体   English

如何为 windows 10 设置 Fred 的 ImageMagick 脚本并从 python 运行这些脚本

[英]How to set Up Fred's ImageMagick Scripts for windows 10 and running those scripts from python

can anyone explain to me in detail to set of environment for Fred's ImageMagick Scripts in windows10 64bit and running those scripts from python?谁能向我详细解释一下在 windows10 windows10 64bitFred's ImageMagick Scripts的环境集并从 python 运行这些脚本? I have installed cywin64 with UNIX bc calculator and ImageMagick and added the path to system variable and downloaded the textcleaner script and convert to .sh and try to run it from python我已经安装了带有 UNIX bc 计算器和ImageMagick并添加了系统变量的路径并下载了textcleaner脚本并转换为.sh并尝试从 Z23EEEB4347BDD265BFC6B7EE9A3B7 运行它

import subprocess

cmd = 'textcleaner.sh -g -e stretch -f 25 -o 20 -t 30 -u -s 1 -T -p 20 abbott2.jpg out.png'

subprocess.call(cmd, shell=True)

and

import subprocess 
bashCommand = "sh textcleaner -g -e normalize -f 5 -o 10 -s 2 C:/Users/RahulNaidu/OneDrive/Desktop/SelvaImages/18420_0.png C:/Users/RahulNaidu/OneDrive/Desktop/SelvaImages/output.png"
process = subprocess.Popen(bashCommand.split(), shell=True, stdout=subprocess.PIPE) 
output, error = process.communicate()

I am getting a new error every time so I need help in sorting out this error每次我都会收到一个新错误,所以我需要帮助来解决这个错误

You need to add the path to textcleaner and if that does not work, then add bash in front of that.您需要添加 textcleaner 的路径,如果这不起作用,则在其前面添加 bash。 The latter depends whether you have added the path to the script in your bash $PATH environment variable.后者取决于您是否在 bash $PATH 环境变量中添加了脚本的路径。

So this works for me.所以这对我有用。

import subprocess

cmd = 'bash ./textcleaner.sh -g -e stretch -f 25 -o 20 -t 30 -u -s 1 -T -p 20 abbott2.jpg out.png'

subprocess.call(cmd, shell=True)


You may get an error message about the bash "type" command not found.您可能会收到有关未找到 bash“type”命令的错误消息。 But that should not affect the processing of the image.但这不应该影响图像的处理。

But please note that my scripts are free only for non-commercial use.但请注意,我的脚本仅供非商业用途免费使用。 Otherwise, you will need to contact me about licensing.否则,您需要就许可事宜与我联系。

Please read the information and pointers for use on my home page at http://www.fmwconcepts.com/imagemagick/index.php .请阅读我的主页http://www.fmwconcepts.com/imagemagick/index.php上的信息和使用指南。 There are links to some documents about running on Windows.有一些关于在 Windows 上运行的文档的链接。 Also see https://imagemagick.org/discourse-server/viewtopic.php?f=26&t=25910另见https://imagemagick.org/discourse-server/viewtopic.php?f=26&t=25910

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM