identify x,y coordinates in an image

Cliff Wells logiplexsoftware at earthlink.net
Wed Nov 7 17:59:51 EST 2001


On Wednesday 07 November 2001 14:35, Steve Holden wrote:
> "Cliff Wells" <logiplexsoftware at earthlink.net> wrote ...

> Well, in my case that should now read  "were tab-indentations": see what OE
> does to your beautiful tabs -- completely lost, along with the sense of the
> code:

Ouch. Okay, let's try with spaces:

def PILToWX(image):
    "convert a PIL image to a wxImage"
    if (image.mode != 'RGB'):
        image = image.convert('RGB')
    imageData = image.tostring('raw', 'RGB')
    imageWx = wxEmptyImage(image.size[0], image.size[1])
    imageWx.SetData(imageData)
    return imageWx

def WXToPIL(image, mode = 'RGBA'):
    "convert a wxImage to a PIL image"
    imageData = image.GetData()
    size = (image.GetWidth(), image.GetHeight())
    imagePIL = Image.fromstring('RGB', size, imageData)
    if mode != 'RGB':
        imagePIL = imagePIL.convert(mode)
    return imagePIL

Good luck,

-- 
Cliff Wells
Software Engineer
Logiplex Corporation (www.logiplex.net)
(503) 978-6726 x308
(800) 735-0555 x308




More information about the Python-list mailing list