Convert image to a new format

We can also use the save() method to specify a different format in which we want to convert the image. For example, here is how I would convert a JPEG image to GIF:

img = Image.open('handsome.jpg')
img.save('handsome.gif', 'gif')

The first parameter of the save() method is the name of the new image, while the second one is the format to which I want to convert to. Some of the most common formats are JPEG, GIF, PNG, and even PDF.

Geek University 2022