tag:blogger.com,1999:blog-36526186.post8475928936253525044..comments2024-03-27T19:43:45.782-07:00Comments on Short IT recipes: Python: an image to an array and an array to an imageWhttp://www.blogger.com/profile/04578057696168658626noreply@blogger.comBlogger3125tag:blogger.com,1999:blog-36526186.post-81192049973706792562013-06-22T02:45:00.184-07:002013-06-22T02:45:00.184-07:00to whom it may concern: this works with color imag...to whom it may concern: this works with color images:<br />def image2array(im):<br /> newArr = numpy.fromstring(im.tostring(),numpy.uint8)<br /> newArr = numpy.reshape(newArr,(im.size[1], im.size[0], 3))<br /> return newArrAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-36526186.post-25335201230153475042012-10-10T08:39:12.410-07:002012-10-10T08:39:12.410-07:00its not working . i m providing 8-bit gray scale b...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 Get Previous Year Question Papershttps://www.blogger.com/profile/13351832749048526434noreply@blogger.comtag:blogger.com,1999:blog-36526186.post-75758991938157401822011-10-11T03:12:15.233-07:002011-10-11T03:12:15.233-07:00thanks, that was useful! Can't believe there i...thanks, that was useful! Can't believe there is no "to_array" routine in PIL.Anonymousnoreply@blogger.com