[Numpy-discussion] Initialize numpy array with other numpy arrays
Robert Kern
robert.kern@gmail....
Thu Feb 19 18:24:54 CST 2009
On Thu, Feb 19, 2009 at 17:03, Frank Peacock <frank@gis4weather.com> wrote:
> Hello
>
>
>
> I would like to know whether I can do the following in some other way as
> this fails with setting an array with a sequence on each of the colour
> arrays:
>
>
>
> h,w=720,410
>
> img = ones((h,w,3), uint8)*255
>
> img[ngridn,ngride]=(ncolour[0],ncolour[1],ncolour[2])
>
> pilImage = Image.fromarray(img, 'RGB')
You probably want to do
for i in range(3):
img[ngridn,ngride,i] = ncolour[i]
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
-- Umberto Eco
More information about the Numpy-discussion
mailing list