1

I want to make changes to my image and want to implement some of the functions that are present in ImageMagick. How can I do the same in Python ? Is there a python binding available?

Here is the link of textcleaner in imagemagick. http://www.fmwconcepts.com/imagemagick/textcleaner/index.php

Ankur Gulati
  • 291
  • 1
  • 12

1 Answers1

2

Textcleaner is my script.

To run any (ImageMagick) bash shell script from Python, you would have to use the subprocess module. An example of this is at How to call a shell script from python code?

Here is an example that you would type in a terminal window or put in a PHP exec() command or from a python subprocess module.

Input:

enter image description here

textcleaner -g -e stretch -f 25 -o 10 -s 1 twinkle.jpg result.jpg

enter image description here

fmw42
  • 46,825
  • 10
  • 62
  • 80
  • How do I install textcleaner on ubuntu? (16.04 LTS) I didn't see any installation instructions on your site. – user2361174 Apr 18 '18 at 20:20
  • 1
    Textcleaner is just a simple text file that calls Imagemagick. It is a Unix shell script. You just download it and call in in a bash shell window or via PHP exec(). You can also call it from Python via th subprocess module. Pointers for use and setup are on my home page at http://www.fmwconcepts.com/imagemagick/index.php – fmw42 Apr 18 '18 at 22:19
  • Any idea why the command description (without any arguments) is being written twice? https://i.stack.imgur.com/sAsnb.png – user2361174 Apr 20 '18 at 18:48
  • 1
    Yes, some versions of Linux repeat the description twice and some do not. If you look on my home page there are some suggested edits you can make to the script that might fix the issue for your version Linux. I do not know which one if any work universally on all flavors of Linux/MacOSX/Window unix/Cygwin, etc. See http://www.fmwconcepts.com/imagemagick/index.php at section 13) of the Pointers for use. – fmw42 Apr 20 '18 at 19:02