title: Loss of image color when I use PIL convert on numpy array (image)
body: <p>I am trying to use PIL with numpy array and then find the dominant color. First, my image is a numpy array (28,28) and is not read from a file. I use the following code to get the dominant color from that image.</p>
  
  <pre><code>from PIL import Image
  import numpy as np
  myimage=np.random.randint(255,size=(28,28))
  image = Image.fromarray(myimage,mode="P") # I use mode=P because if I didn't I will get an error in the next line.
  result = image.convert('P', palette=Image.ADAPTIVE, colors=1)
  result.putalpha(0)
  colors = result.getcolors()
  </code></pre>
  
  <p>Now <code>colors</code> is always black <code>[(784,(14,14,14,0)]</code>, however, if I saved <code>myimage</code> to a file and use <code>image=Image.open(myimage.png)</code> I get the correct <code>colors=[(5807904, (222, 158, 23, 0))]</code>. Any ideas why is that happening and how to fix it. The reason I am not saving the image to a files first is because of efficiency measures because I have thousands of images that I loop within them.</p>
  
  <p>Thanks,</p>