title: PIL "ValueError: image has wrong mode" when resizing an image
body: <p>I am working in Blender and so I wanted to use a bump map I found on the internet.
  The image is <a href="https://s3.amazonaws.com/blenderguru.com/uploads/2016/02/Bump.jpg" rel="nofollow">here</a>. However, when I tried to use it, Blender crashed. I am assuming that happened because of the size of the image. That's why I wanted to create a simple script that would resize an image.</p>
  
  <p>This is my script:</p>
  
  <pre><code>from PIL import Image
  from math import sqrt
  
  path = raw_input("Enter file path: ")
  
  Image.warnings.simplefilter('ignore', Image.DecompressionBombWarning)
  img = Image.open(path)
  size = img.size
  pixelsize = size[0] * size[1]
  print "Current pixel size:", pixelsize
  
  maxsize = input("Enter maximum pixel size: ")
  
  img = img.convert(mode="RGB")
  square1 = sqrt(pixelsize)
  ratio = (size[0] / square1, size[1] / square1)
  square2 = sqrt(maxsize)
  newsize = (int(round(maxsize * ratio[0])), int(round(maxsize * ratio[1])))
  img = img.resize(newsize)
  
  oldname = path.split("/")[-1]
  newname = "SMALLER_" + oldname
  
  img.save(newname)
  </code></pre>
  
  <p>When I run the script I get the following error:</p>
  
  <pre><code>Traceback (most recent call last):
    File "C:/Users/*****/Desktop/smaller/makeImageSmaller.py", line 19, in &lt;module&gt;
      img = img.resize(newsize)
    File "C:\Python27\lib\site-packages\PIL\Image.py", line 1550, in resize
      return self._new(self.im.resize(size, resample))
  ValueError: image has wrong mode
  </code></pre>
  
  <p>As you can see from the script, I already tried changing the mode to "RGB" (line 14), assuming that would fix the problem.</p>
  
  <p>The image is quite large but I don't get the memory error.</p>
  
  <p>I am stuck on that problem for quite a while and I just don't know what the problem is. Any help would be appreciated.</p>