So, now that we understood the basics of adding circles, arcs and text on an Image created brand new in PIL, withou using any image on the hard drive or elsewhere, let's watermark our image with a different font-size... I also changed some parts of the code that had no sense, due to some changes made making different version of this code... from PIL import Image , ImageDraw , ImageFont # sample text and font unicode_text = u"SMILE WORLD!" # This is used to shape the image around the text size font = ImageFont . truetype ( "consola.ttf" , 28 , encoding = "unic" ) font2 = ImageFont . truetype ( "consola.ttf" , 10 , encoding = "unic" ) # get the line size text_width , text_height = font . getsize ( unicode_text ) # create a blank canvas with extra space between lines # I added 100 to host the image and 30 for the watermark length canvas = Image . new ( 'RGB' , ( text_width + 30 , text_hei...
Comments
Post a Comment