Reputation: 2269
I had initially written all the image magic commands in linux environment for executing in shell scripts. But now due to some functionality to be added I have to implement it through python. Will the same command be compatible? If not how do I go about it?
#!/bin/sh
for f in `ls *.png`
do
montage -geometry +0+0 -background skyblue -font /usr/share/fonts/dejavu- lgc/DejaVuLGCSansCondensed-Oblique.ttf -label "$f" $f ./label_added/$f
done
And also the following command :
convert n255_n2.tif -gravity West -splice 0x18 -annotate +0+2 "x parameter" n255_n3.tif
Upvotes: 0
Views: 238
Reputation: 5693
Try this:
import glob
import subprocess
for f in glob.glob('*.png'):
subprocess.call(['montage', '-geometry', '+0+0',
'-background', 'skyblue',
'-font',
'/usr/share/fonts/dejavu-lgc/DejaVuLGCSansCondensed-Oblique.ttf',
'-label',
'"%s"' % f, f, './label_added/%s' % f])
Upvotes: 1
Reputation: 826
Well. Basically there is similar solution explained in this thread this thread. You need to launch imagemagick in separate process.
Upvotes: 1