[Numpy-discussion] array is not writable
Charles R Harris
Wed Aug 26 23:43:13 CDT 2009
On Wed, Aug 26, 2009 at 10:34 PM, David Warde-Farley <firstname.lastname@example.org>wrote:
> On 26-Aug-09, at 11:49 PM, Mark Wendell wrote:
> > Figured this much out: if I do an np.copy of the original array to a
> > new array, then I can edit individual 'color' values with impunity. So
> > I guess the original array from the pil object still shares memory
> > with that image object somehow, making it unwritable?
> I'm going to guess that it's because PIL is still responsible for that
> memory, not NumPy. I don't really know how this stuff works but
> asarray() would just give you a view onto that chunk of memory; since
> NumPy didn't allocate it, it probably doesn't want to modify it. Not
> sure if you can get away with not making a copy in this situation.
I expect you can. It's the unreadable arrays that are a problem...
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion