On Jan 12, 7:32 pm, 74yrs old <withblessi...@gmail.com> wrote:
> Dear Sarkar,
> Tried to run the following program - which was copied from your websitehttp://hacking-tesseract.blogspot.com/
> * file name: image.py*
> #!/usr/local/bin/python
>
> #-*- coding:utf8 -*-
>
> importImagefont,ImageDraw
>
> from PIL import Image
>
> im = Image.new("RGB",(400,400))
> #im.show()
>
> draw = ImageDraw.Draw(im)
>
> # use a truetype font
> font=
> ImageFont.truetype("/usr/share/fonts/truetype/ttf-bengali-fonts/lohit_bn.ttf",50)
>
> txt1="ক"
> txt2=" ি"
> txt=txt2+txt1
>
> draw.text((10, 10), unicode(txt,'UTF-8'), font=font)
>
> *When run in terminal of ubuntu9.04 error message displayed as follow:*
import ImageFont, ImageDraw
it seems you have put space between ImageFont in import statement
When run in terminal of ubuntu9.04 error message displayed as follow:
sriranga@ubuntu:~$ cd Desktop/
sriranga@ubuntu:~/Desktop$ python ./image.py
File "./image.py", line 6
import image Font,ImageDraw
^
SyntaxError: invalid syntax
sriranga@ubuntu:~/Desktop$
Request for guidance how to aviod invalid syntax?
With regards,
-sriranga(77yrsold)
ImportImageFont,ImageDraw
Please change it to:
import ImageFont, ImageDraw
Please note the spaces and the comma. 'import' and 'ImageFont' and
'ImageDraw' are different words.
font= ImageFont.truetype("C:\