Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: Python scripting with Paint Shop Pro 8.0

Reply
Thread Tools

Re: Python scripting with Paint Shop Pro 8.0

 
 
Marc Wilson
Guest
Posts: n/a
 
      07-24-2003
In comp.lang.python, Martin Franklin
<(E-Mail Removed)> (Martin Franklin) wrote in
<(E-Mail Removed)>::

|The second way would be to paste a SOLD image onto the original image
|
|im = Image.open("gnome-mixer.jpg")
|im.paste(Image.open("sold.jpg"), (5, 5))
|
That would be the preferred option: we already have a suitable JPEG for the
system we use now.

Thanks- you guys are so helpful to a clue-impaired newbie.
--
Marc Wilson

Cleopatra Consultants Limited - IT Consultants
2 The Grange, Cricklade Street, Old Town, Swindon SN1 3HG
Tel: (44/0) 70-500-15051 Fax: (44/0) 870 164-0054
Mail: http://www.velocityreviews.com/forums/(E-Mail Removed) Web: http://www.cleopatra.co.uk
__________________________________________________ _______________
Try MailTraq at https://my.mailtraq.com/register.asp?code=cleopatra
 
Reply With Quote
 
 
 
 
Marc Wilson
Guest
Posts: n/a
 
      07-24-2003
In comp.lang.python, Duncan Booth <(E-Mail Removed)> (Duncan Booth)
wrote in <Xns93C2B04C1DD91duncanrcpcouk@127.0.0.1>::

|Marc Wilson <(E-Mail Removed)> wrote in
|news:(E-Mail Removed):
|
|> Oh, and- is there a way to overwrite text onto an image? The site is
|> a house-sales site, and we want to overwrite "SOLD" across the
|> thumbnail once a property is sold. It looks like I can do this with
|> the ImageDraw module, but I can't see how to replicate what we do now
|> with Image Robot, which is to write "SOLD" across the image diagonally
|> (using the Add Watermark feature). Any ideas?
|
|How about this:
|
|from PIL import Image, ImageFont, ImageDraw, ImageChops
|
|im = Image.open("test.jpg")
|im.thumbnail((128, 12, Image.ANTIALIAS)
|
|font = ImageFont.truetype("arial.ttf", 30)
|
|def AddOverlay(im, origin, text, angle=-45):
| # Create an overlay with white text and subtract it from the image.
| # This effectively blacks out the area to be overlaid.
| overlay = Image.new(im.mode, im.size)
| draw = ImageDraw.Draw(overlay)
| draw.text(origin, text, (255, 255, 255), font=font)
| overlay = overlay.rotate(angle)
| stamped = ImageChops.subtract(im, overlay, 1, 0)
|
|
| # Now create a red overlay and add it to the subtracted image
| overlay = Image.new(im.mode, im.size)
| draw = ImageDraw.Draw(overlay)
| draw.text(origin, text, (255, 0, 0), font=font)
| overlay = overlay.rotate(angle)
| stamped = ImageChops.add(stamped, overlay, 1, 0)
| return stamped
|
|stamped = AddOverlay(im, (10, 50), "SOLD!")
|stamped.show()

Yep- that works a treat. Incidentally, why do I need to remove the text
area before overwriting it? Or am I missing the point?
--
Marc Wilson

Cleopatra Consultants Limited - IT Consultants
2 The Grange, Cricklade Street, Old Town, Swindon SN1 3HG
Tel: (44/0) 70-500-15051 Fax: (44/0) 870 164-0054
Mail: (E-Mail Removed) Web: http://www.cleopatra.co.uk
__________________________________________________ _______________
Try MailTraq at https://my.mailtraq.com/register.asp?code=cleopatra
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Powerdesk Pro: viewing pspimage files from Paint Shop Pro? MitchellWmA Computer Support 1 10-05-2008 05:01 PM
paint shop pro 4 help The White Lady Computer Support 6 06-11-2004 04:09 PM
Paint Shop Pro now speaks German? User Computer Support 5 09-25-2003 07:07 AM
Re: Python scripting with Paint Shop Pro 8.0 Greg Brunet Python 4 07-23-2003 01:46 PM
Re: Python scripting with Paint Shop Pro 8.0 Aahz Python 5 07-22-2003 08:14 AM



Advertisments