Namespaces

Variants
Actions

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Archived:How to add a text to an image in PySymbian

From Wiki
Jump to: navigation, search

Archived.pngAquivado: 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)


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 (31 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

Text on a Blank Image
Text on existing photo of a Green Circle

Related Links

How to edit an image

This page was last modified on 31 May 2013, at 01:08.
79 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×