i.e. some stuff and junk about Python, Perl, Matlab, Ruby, Mac X, Linux, Solaris, ...
thanks, that was useful! Can't believe there is no "to_array" routine in PIL.
its not working . i m providing 8-bit gray scale bmp image and as a result i want the same 8-bit gray scale bmp image
to whom it may concern: this works with color images:def image2array(im): newArr = numpy.fromstring(im.tostring(),numpy.uint8) newArr = numpy.reshape(newArr,(im.size[1], im.size[0], 3)) return newArr
thanks, that was useful! Can't believe there is no "to_array" routine in PIL.
ReplyDeleteits not working . i m providing 8-bit gray scale bmp image and as a result i want the same 8-bit gray scale bmp image
ReplyDeleteto whom it may concern: this works with color images:
ReplyDeletedef image2array(im):
newArr = numpy.fromstring(im.tostring(),numpy.uint8)
newArr = numpy.reshape(newArr,(im.size[1], im.size[0], 3))
return newArr