简体   繁体   中英

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? 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

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. The latter depends whether you have added the path to the script in your bash $PATH environment variable.

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. 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 . There are links to some documents about running on Windows. Also see https://imagemagick.org/discourse-server/viewtopic.php?f=26&t=25910

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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