[SciPy-User] fromimage/imread segfaults on my images
Daniel Lenski
dlenski at gmail.com
Mon Mar 8 10:09:37 EST 2010
Hi all,
I'm using SciPy to process some sparse binary images with a resolution of
about 5000x5000 pixels. I try to load images like this:
im = Image.open('/tmp/foo.pbm')
print "Image loaded, size is %s and mode is %s." % (im.size, im.mode)
arr = fromimage(im)
or
arr = imread('/tmp/foo.pbm')
In either case, I get a segfault. The segfault is definitely in the
SciPy code, rather than the PIL code, since PIL's Image.open runs fine.
I ran strace, and there's an attempt to mmap() a region as large as the
image, one byte per pixel, immediately before the segfault:
mmap(NULL, 21463040, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS,
-1, 0) = 0x7f278b5be000
The funny thing is... the imread() implementation in pylab *does* work,
but it converts all images to RGB mode and reverses them vertically for
no apparent reason. So I'd rather not use it. Is this a known bug in
SciPy? Any workarounds/fixes? I don't know any other good, reliable way
to get a big image into an array :-(
Dan
More information about the SciPy-User
mailing list