.save()
Published Mar 27, 2025
Contribute to Docs
In the Pillow library, the .save()
method saves an image to a specified filename. The filename, provided by the user or the code writer, determines the format in which the image is saved.
Syntax
image.save(fp, format=none, **params)
Parameters:
fp
: The file path or file object where the image will be saved.format
(Optional): The format to save the image in (e.g.,"JPEG"
,"PNG"
). If omitted, Pillow infers the format from the file extension.**params
(Optional): Additional parameters specific to the image format.
Return value:
The .save()
method in Pillow does not return anything. It performs an in-place operation to save the image file.
Example
The image to be used in this example is:
The following example demonstrates the usage of the .save()
method:
from PIL import ImagenewImage = Image.open("blueMacaw.jpg")newImage.save("fluffy.jpg")
The given code opens an image file (blueMacaw.jpg
) and saves it under a new name (fluffy.jpg
).
Contribute to Docs
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.
Learn Python:Pillow on Codecademy
- Career path
Data Scientist: Machine Learning Specialist
Machine Learning Data Scientists solve problems at scale, make predictions, find patterns, and more! They use Python, SQL, and algorithms.Includes 27 CoursesWith Professional CertificationBeginner Friendly95 hours - Course
Learn Python 3
Learn the basics of Python 3.12, one of the most powerful, versatile, and in-demand programming languages today.With CertificateBeginner Friendly23 hours