title: Image reshape is not working in Pillow for grey image?
body: <p>i am using below code to reshape my image. It's working for RGB image. But, it's not working for grey scale image.</p>
  
  <pre><code>from PIL import Image
  import numpy as np
  def load_image_into_numpy_array(image):
      (im_width, im_height) = image.size
      return np.array(image).reshape((im_height, im_width, 3)).astype(np.uint8)
  
  image_path="color.jpg"
  image = Image.open(image_path)
  image_np = load_image_into_numpy_array(image)
  image.close()
  </code></pre>
  
  <p>This is working image <code>color.jpg</code></p>
  
  <p><a href="https://i.stack.imgur.com/l5dcf.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/l5dcf.jpg" alt="enter image description here"></a></p>
  
  <p>This is not working image <code>grey.jpg</code></p>
  
  <p><a href="https://i.stack.imgur.com/WR1EV.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WR1EV.jpg" alt="enter image description here"></a></p>
  
  <p>Both images shapes' are same.</p>
  
  <p><code>image.size</code></p>
  
  <blockquote>
    <p>(714, 714)</p>
  </blockquote>
  
  <p>When I print image i found a differnce.</p>
  
  <p>Working image <code>print(image)</code></p>
  
  <pre><code> &lt;PIL.JpegImagePlugin.JpegImageFile image mode=RGB size=714x714 at 0x7F95DB4D4BA8&gt;
  </code></pre>
  
  <p>not working image <code>print(image)</code></p>
  
  <pre><code> &lt;PIL.JpegImagePlugin.JpegImageFile image mode=L size=714x714 at 0x7F32B5430BA8&gt;
  </code></pre>
  
  <ol>
  <li>how to fix the issue? </li>
  <li>Is this because of mode changes? </li>
  </ol>
  
  <p>Any help would be appreciable. </p>
  
  <p>Error:</p>
  
  <pre><code>Traceback (most recent call last):
    File "checker.py", line 11, in &lt;module&gt;
      image_np = load_image_into_numpy_array(image)
    File "checker.py", line 5, in load_image_into_numpy_array
      return np.array(image).reshape((im_height, im_width, 3)).astype(np.uint8)
  ValueError: cannot reshape array of size 509796 into shape (714,714,3)
  </code></pre>