Archived:How to add a text to an image in PySymbian
Aquivado: Este artigo foi arquivado, pois o conteúdo não é mais considerado relevante para se criar soluções comerciais atuais. Se você achar que este artigo ainda é importante, inclua o template {{ForArchiveReview|escreva a sua justificativa}}.
Acredita-se que este artigo ainda seja válido no contexto original (quando ele foi escrito)
Acredita-se que este artigo ainda seja válido no contexto original (quando ele foi escrito)
This article contains code snippets showing how text can be added to an image or a photo in PySymbian.
Article Metadata
Tested with
Devices(s): Nokia N96
Compatibility
Platform(s): S60 2nd Edition, S60 3rd Edition
Platform Security
Capabilities: )
Article
Keywords: graphics, image
Created: User:Kandyfloss
(28 Apr 2008)
Last edited: hamishwillee
(08 May 2013)
Contents |
Code
How to add text to a blank image
# import module
from graphics import *
# Open new blank Image of given size
bg=Image.new((240,240))
# Write text at given position
bg.text((30,30), u"Text", font="title")
# Save the new Image
bg.save("C:\\TextOnImage.jpg", quality=100)
How to add text to a photo
# import module
from graphics import *
# Open an existing Image
photo=Image.open("c:\\myphoto.jpg")
# Write text at given position
photo.text((100,80), u"Green Circle", font="normal")
# Save the new Image
photo.save("c:\\TextOnPhoto.jpg")
Postconditions
We obtain following resulting images from above code




24 Sep
2009