from PIL import Image image = Image.open("test.jpg") image.save("test2.jpg", quality=0, optimize=True)