title: Convert image color space to RGB in Python
body: <p>I'm working on the image processing script(<code>Python</code> with <code>PIL</code> library) and i need to convert color space of any image to <code>RGB</code>. I've tried this trick, but it works only with <code>png</code> images in <code>RGBa</code> color space:</p>
  
  <pre><code>image = Image.open(imageFile)
  image.load()
  
  # replace alpha channel with white color
  self.im = Image.new('RGB', image.size, (255, 255, 255))
  self.im.paste(image, mask=image.split()[3])
  </code></pre>
  
  <p>How to make this code universally to all images in any colorspace?</p>
  
  <p>Thanks.</p>