title: Image Conversion - Cannot write mode RGBA as JPEG
body: <p>I'm trying to resize &amp; reduce quality of image before upload in project. Here's what I tried,</p>
  
  <pre><code>def save(self):
      im = Image.open(self.image)
      output = BytesIO()
      im = im.resize(240, 240)
      im.save(output, format='JPEG', quality=95)
      output.seek(0)
      self.image = InMemoryUploadedFile(output, 'ImageField', "%s.jpg" % self.image.name.split('.')[0], 'image/jpeg', sys.getsizeof(output), None)
      super(Model, self).save()
  </code></pre>
  
  <p>It's working fine if I upload a <code>jpg</code> image but if I upload a <code>png</code> or any other image type, it's not working it's raising errors like <code>cannot write mode RGBA as JPEG</code> &amp; <code>cannot write mode P as JPEG</code> etc.</p>
  
  <p>How can we fix that? Thank You!</p>