convert png to jpg python code example

Example 1: python pillow convert jpg to png

from PIL import Image

im1 = Image.open(r'C:\Users\Ron\Desktop\Test\autumn.jpg')
im1.save(r'C:\Users\Ron\Desktop\Test\new_autumn.png')

Example 2: python convert png to jpg

from PIL import Image

img = Image.open('image.png')
rgb_img = img.convert('RGB')
rgb_img.save('image.jpg')

Example 3: png to jpg

Windows:
Right click on file.
Open with Paint.
File > Save As > JPEG Picture

Example 4: png to jpg

hey, this is a good converter!

https://png2jpg.com/

Tags:

Misc Example