[Image-SIG] problem with putdata function
Cai Xiao(dynaturtle)
dynaturtle.cai at gmail.com
Tue May 12 07:11:55 CEST 2009
Hey, I am new to PIL. And I have a problem with putdata function when I try
to load some data to the image objectThe code is as following:
1. mode = 'RGB'
2. size = (sregion.right - sregion.left, sregion.top -
sregion.bottom)
3. im = Image.new(mode, size)
4.
5. if type == 'dem':
6. minV = band.GetMinimum()
7. maxV = band.GetMaximum()
8. imData = []
9. for j in range(size[1]):
10. for i in range(size[0]):
11. heightValue = int((rasterTuple[i * size[0] + j] -
minV) * 255 / (maxV - minV))
12. pixelValue = (i,j,heightValue)
13. imData.append(pixelValue)
14.
15. im.putdata(imData)
I got a error when the program run to line 15, the error information is
as following:
OverflowError: 'long int too large to convert to int'
the imData length is 981760, and my computer memory is 2GB
Can anyone help me fix the problem?
Thanks
--
Department of Spatial Information Science&Technology,
School of Earth&Space Science, Peking University
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/image-sig/attachments/20090512/9353be31/attachment.htm>
More information about the Image-SIG
mailing list