Namespaces
Variants
Actions

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

Jump to: navigation, search
Archived.png
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)


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

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 8 May 2013, at 08:16.
175 page views in the last 30 days.
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved