[英]How to set Up Fred's ImageMagick Scripts for windows 10 and running those scripts from python
誰能向我詳細解釋一下在 windows10 windows10 64bit
中Fred's ImageMagick Scripts
的環境集並從 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)
和
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()
每次我都會收到一個新錯誤,所以我需要幫助來解決這個錯誤
您需要添加 textcleaner 的路徑,如果這不起作用,則在其前面添加 bash。 后者取決於您是否在 bash $PATH 環境變量中添加了腳本的路徑。
所以這對我有用。
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)
您可能會收到有關未找到 bash“type”命令的錯誤消息。 但這不應該影響圖像的處理。
但請注意,我的腳本僅供非商業用途免費使用。 否則,您需要就許可事宜與我聯系。
請閱讀我的主頁http://www.fmwconcepts.com/imagemagick/index.php上的信息和使用指南。 有一些關於在 Windows 上運行的文檔的鏈接。 另見https://imagemagick.org/discourse-server/viewtopic.php?f=26&t=25910
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.