How do I use Python PIL to save an image to a specific directory?

For example, I want to manipulate some image and then save it to a specific directory. How do I save in a specific directory different from the one I'm working in? I understand that this will save in the directory I am in:

from PIL import Image
""" Some Code """
img.save("sample.png", "")

      

How can I save to another driectory?

+3


source to share


1 answer


try it



img.save('/absolute/path/to/myphoto.jpg', 'JPEG')

      

+5


source







All Articles