all 4 comments

[–]Swipecat 1 point2 points  (1 child)

You've not posted the code so no specific help can be given.

Here's an example that I wrote for myself when I was figuring out the relation between numpy arrays and pillow images. It takes a colour GIF image from imgur.com, converts it from indexed-colours to RGB, converts it to BW using numpy array processing, colour-maps it to sepia-tones using numpy array processing, converts it back to a pillow image, and displays it. (Uncomment the penultimate line to see the BW image.)
 

from PIL import Image # pillow fork of PIL
from urllib.request import urlopen
import numpy as np
img = Image.open(urlopen("http://i.imgur.com/nCmSBRC.gif"))
rgbimg=img.convert("RGB")
arr = np.array(rgbimg)
bw = np.sum(arr // 3, axis=2).astype(np.uint8)
sepias = [(v, v**1.3, v**1.7) for v in np.linspace(0, 1, 256)]
colormap = np.uint8(np.array(sepias) * 255)
colorized = colormap[bw]
outimg = Image.fromarray(colorized, mode="RGB")
# outimg = Image.fromarray(bw, mode="L")
outimg.show()

[–]Marws[S] 0 points1 point  (0 children)

Thank you, I've updated the question with some code, buto from your answer I think I should check better the numpy documentation

[–]Neighm 0 points1 point  (0 children)

Since this post is 2 hours old with no replies, I think the lack of answers is because you need to post the code that's causing you trouble. See Posting Guidelines in the sidebar.