>>725
format="JPEG"でやってみたんですけど、次のようなエラーが出ます。

]>> newImg.save("gazou.jpg", format="JPEG")
Traceback (most recent call last):
File "/Users/hogehoge/venvpy/3.9/lib/python3.9/site-packages/PIL/JpegImagePlugin.py", line 610, in _save
rawmode = RAWMODE[im.mode]
KeyError: 'P'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/hogehoge/venvpy/3.9/lib/python3.9/site-packages/PIL/Image.py", line 2164, in save
save_handler(self, fp, filename)
File "/Users/hogehoge/venvpy/3.9/lib/python3.9/site-packages/PIL/JpegImagePlugin.py", line 612, in _save
raise OSError(f"cannot write mode {im.mode} as JPEG") from e
OSError: cannot write mode P as JPEG