mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-08-01 02:50:05 +03:00
Small changed, using range() instead of deprecated xrange()
This commit is contained in:
parent
03c5242269
commit
acdda34589
|
@ -6,7 +6,7 @@ how to run
|
||||||
|
|
||||||
[ -d image_resources ] || mkdir image_resources
|
[ -d image_resources ] || mkdir image_resources
|
||||||
wget http://upload.wikimedia.org/wikipedia/commons/6/69/Captcha.jpg -O image_resources/captcha.jpg
|
wget http://upload.wikimedia.org/wikipedia/commons/6/69/Captcha.jpg -O image_resources/captcha.jpg
|
||||||
python crop/croip.py
|
python crop/crop.py
|
||||||
|
|
||||||
## Build it on Mac OS X 10.6.*
|
## Build it on Mac OS X 10.6.*
|
||||||
|
|
||||||
|
|
|
@ -22,8 +22,8 @@ def print_im(im, w=None, h=None):
|
||||||
else:
|
else:
|
||||||
pixels = im
|
pixels = im
|
||||||
|
|
||||||
for x in xrange(w):
|
for x in range(w):
|
||||||
for y in xrange(h):
|
for y in range(h):
|
||||||
|
|
||||||
if pixels[x, y] > 128:
|
if pixels[x, y] > 128:
|
||||||
print " ",
|
print " ",
|
||||||
|
|
|
@ -23,8 +23,8 @@ im = im.draft("L", im.size)
|
||||||
pixsels = im.load()
|
pixsels = im.load()
|
||||||
|
|
||||||
|
|
||||||
for x in xrange(w):
|
for x in range(w):
|
||||||
for y in xrange(h):
|
for y in range(h):
|
||||||
if pixsels[x, y] > 128:
|
if pixsels[x, y] > 128:
|
||||||
pixsels[x, y] = WHITE
|
pixsels[x, y] = WHITE
|
||||||
else:
|
else:
|
||||||
|
@ -32,8 +32,8 @@ for x in xrange(w):
|
||||||
|
|
||||||
|
|
||||||
counts = []
|
counts = []
|
||||||
for x in xrange(w):
|
for x in range(w):
|
||||||
count = len([1 for y in xrange(h)
|
count = len([1 for y in range(h)
|
||||||
if pixsels[x, y] is BLACK])
|
if pixsels[x, y] is BLACK])
|
||||||
|
|
||||||
counts.append(count)
|
counts.append(count)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user