On Thu 21 Feb 2008 05:47:22 Sahar Vilan wrote:
> Can anyone help me with transformation from numpy array to image (at PIL
> library)?
> I want to change an array (at numpy) into an image (at Image) in order to
> rotate the image and save it in standard image format.
>
> Tahnks,
> Sahar Vilan
>
>

Hi...

Sorry for the long delay.
These convertions in python among data and image representation indeed require 
some experimentation.  

(In my todo list, wiht low priority, I have a python module that would 
seamlessly translate image data across various image handling 
bindings/ibraries and numerical types).

Fortunatey, in this case it is rather simple:

For numpy.array -> python image, you do something like:

a = numpy.array ("\x0"  (WIDTH  * HEIGHT  * 3), "B")
#code to create imag data inside array
# (...)
i  = Image.new("RGB", (WIDTH, HEIGHT))

i.fromstring(a.tostring())
i.save(filename)


        js
        -><-

>
>
>
>
> ***************************************************************************
>**************************** This e-mail message may contain
> confidential,and  privileged information or data that constitute
> proprietary information of CMT Medical Ltd. Any review or distribution by
> others is strictly prohibited. If you are not the intended recipient you
> are hereby notified that any use of this information or data by any other
> person is absolutely prohibited. If you are not the intended recipient,
> please delete all copies. Thank You. http://www.cmt.co.il
> ***************************************************************************
>*****************************
>
>
>
>
>
>
>
> ***************************************************************************
>********* This footnote confirms that this email message has been scanned by
> PineApp Mail-SeCure for the presence of malicious code, vandals & computer
> viruses.
> ***************************************************************************
>*********


_______________________________________________
Image-SIG maillist  -  Image-SIG@python.org
http://mail.python.org/mailman/listinfo/image-sig

Reply via email to