Progress

January 28, 2009 at 9:55 pm (Uncategorized) (, , )

	for akshar in alphabets:
		#print akshar

		draw.text((x, y), unicode(akshar,'UTF-8'), font=font)
		leftx=x-20 #the left end of the small bounding box
		box=(leftx,y,x+100,y+60) #the box in the big image within which the small image of interest lies
		sub_im=im.crop(box)
		#sub_im.show()
		bbox_sub=sub_im.getbbox() #get the bounding box of the black pixels in the sub image, not the big image
		bbox_im=(leftx+bbox_sub[0],y+bbox_sub[1],leftx+bbox_sub[2],y+bbox_sub[3]) #calculate relative to the big image
		draw.rectangle(bbox_im)
		print bbox_im

This block of code was instrumental in giving http://debayanin.googlepages.com/haha.jpg

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: