[Numpy-discussion] array is not writable

Mark Wendell mark.wendell at gmail.com
Wed Aug 26 21:48:46 EDT 2009


Hi all - I'm playing with editing image data converted from PIL objects, and
running into a situation where numpy tells me that an 'array is not
writable'. Not sure I understand what that means, or how to get around it.
Here's a sample interactive session:

>>> import Image
>>> import numpy as np
>>> im = Image.open("rgb.0001.jpg")
>>> a = np.asarray(im)
>>> a.shape
(512, 512, 3)
>>> a.dtype
dtype('uint8')
>>> a[0,0,0]
254
>>> a[0,0,0] = 10
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
RuntimeError: array is not writeable


Any help appreciated. Thanks,
Mark

PIL 1.1.6
numpy 1.2.1
Ubuntu 9.04

-- 
--
Mark Wendell
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20090826/2d6b45f5/attachment.html>


More information about the NumPy-Discussion mailing list