13

Simple one I think but essentially I need to know what the syntax is for the save function on the PIL. The help is really vague and I can't find anything online. Any help'd be great, thanks :).

1
  • 1
    By "help" are you referring to the docstring that says nothing but "Save image to file or stream"? :( Commented Apr 30, 2012 at 6:16

2 Answers 2

18

From the PIL Handbook:

im.save(outfile, options...)

im.save(outfile, format, options...)

Simplest case:

im.save('my_image.png')

or whatever. In this case, the type of the image will be determined from the extension. Is there a particular problem you're having? Or specific saving option that you'd like to use but aren't sure how to do so?

You may be able to find additional information in the documentation on each filetype. The PIL Handbox Appendixes list the different file types that are supported. In some cases, options are given for save. For example, on the JPEG file format page, we're told that save supports

  • quality
  • optimize, and
  • progressive

with notes about each option.

Sign up to request clarification or add additional context in comments.

2 Comments

Good answer to bad question (the resource is definetly available online). :)
may ik which options can be mentioned for format..??
1

Image.save(filename[, format[, options]]). You can usually just use Image.save(filename) since it automatically figures out the file type for you from the extension.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.