Converting .jpg images to .png

You could always use the Python Image Library (PIL) for this purpose. There might be other packages/libraries too, but I’ve used this before to convert between formats.

This works with Python 2.7 under Windows (Python Imaging Library 1.1.7 for Python 2.7), I’m using it with 2.7.1 and 2.7.2

from PIL import Image

im = Image.open('Foto.jpg')
im.save('Foto.png')

Note your original question didn’t mention the version of Python or the OS you are using. That may make a difference of course 🙂

Leave a Comment