William Stein wrote:
> On Thu, Apr 2, 2009 at 4:45 PM, Jason Grout <[email protected]> 
> wrote:
>> sageuser wrote:
>>> Hi, I'm new to sage. I need to test some algorithm that processes
>>> bitmap image file (.bmp) in sage.
>>>
>>> On input, is there any existing package that read in a .bmp file and
>>> returns a 2-dimensional array of RGB (or just gray level is fine)?
>>>
>>> On output, is there any package does the reverse of the above?
>>
>> Install the PIL spkg.  You can see
>> http://www.pythonware.com/library/pil/handbook/ for documentation.
>>
>> Jason
>>
> 
> You can also read *png* files easily with
> 
> import pylab
> A = pylab.imread(DATA + 'emoryimage.png')


I think that once you install PIL, the imread command can read in bmps 
too (and any other format PIL supports):

sage -i pil-1.1.6

<wait a minute or two for the installation>

$ sage
----------------------------------------------------------------------
| Sage Version 3.4, Release Date: 2009-03-11                         |
| Type notebook() for the GUI, and license() for information.        |
----------------------------------------------------------------------
sage: import pylab
sage: a=pylab.imread('test.bmp')
sage: a[0][0] # first pixel
array([0, 0, 0], dtype=uint8)


Thanks,

Jason


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to