0

Here I am trying to process an image using a php script textcleaner. I have to run this php script in my other part of python project.I'm confused in getting the output image from php script textcleaner(I get this script from here :

http://www.fmwconcepts.com/imagemagick/textcleaner/index.php )

and my code in python for running it is as ..

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()

Here textcleaner.php is php script file and after that (-g -e none -f 10 -o 5) are the arguments those i want to pass to script(textcleaner) for processing my image(src.jpg) and the output image should be out.jpg

If any one used this before or know how to get the output in out.jpg as an image please tell me .

I also checked script_response by using print() but it gives me the help menu of textcleaner .

Marius
  • 15,148
  • 9
  • 56
  • 76
ajay kumar
  • 29
  • 1
  • 4

1 Answers1

0

This answer Running bash script from within python may point you in the right direction - I do not use Python or bash so can not help further.

import subprocess
print "start"
subprocess.call("textcleaner -g -e none -f 10 -o 5 src.jpg out.jpg")
print "end"

Do not forget to make textcleaner executable e.g 777 or 755 may work. I would rename textcleaner to textcleaner.sh and use textcleaner.sh in your code. It just reminds you what the file type is.

Community
  • 1
  • 1
Bonzo
  • 5,169
  • 1
  • 19
  • 27