PIL implementation

circusdei arkestra at gmail.com
Sat Jan 7 02:20:30 EST 2006


I wrote this snippet with the intention of -- capturing a section of
the screen whenever it changes.  It could be implemented to log any
sort of messaging system ( by saving consecutive images eg.
1.png...etc).

#code --------------------

import Image
import ImageGrab
lastchatbound = (21, 504) + (189, 516)
img1 = ImageGrab.grab(lastchatbound)
data1 = list(img1.getdata())
img2 = ImageGrab.grab(lastchatbound)
data2 = list(img2.getdata())
# print `data1`
if data1 != data2:
    img1.save(`picnumber` + '.png')
    picnumber = picnumber + 1
    else:
        print "same"

#code ------------------

it doesn't work yet and i'm not quite sure how the loops work yet ( i
just sarted python last week). any help anyone could give me would be
appreciated.

if someone could rewrite it so it works, i could use that as an example
for the future, thanks.

- mb




More information about the Python-list mailing list