I am trying to convert png to jpeg using pillow. I\'ve tried several scrips without success. These 2 seemed to work on small png images like this one.
First
The issue with that image isn't that it's large, it is that it isn't RGB, specifically that it's an index image.
Here's how I converted it using the shell:
>>> from PIL import Image
>>> im = Image.open("Ba_b_do8mag_c6_big.png")
>>> im.mode
'P'
>>> im = im.convert('RGB')
>>> im.mode
'RGB'
>>> im.save('im_as_jpg.jpg', quality=95)
So add a check for the mode of the image in your code:
if not im.mode == 'RGB':
im = im.convert('RGB')