def save(self, fp, format=None, **params):

        if isStringType(fp):
            filename = fp
        else:
            if hasattr(fp, "name") and isStringType(fp.name):
                filename = fp.name
            else:
                filename = ""

        # may mutate self!
        self.load()

        self.encoderinfo = params
        self.encoderconfig = ()

        preinit()

        ext = string.lower(os.path.splitext(filename)[1])

        if not format:
            try:
                format = EXTENSION[ext]
            except KeyError:
                init()
                try:
                    format = EXTENSION[ext]
                except KeyError:
                    raise KeyError(ext) # unknown extension

        try:
            save_handler = SAVE[string.upper(format)]
        except KeyError:
            init()
            save_handler = SAVE[string.upper(format)] # unknown format

        if isStringType(fp):
            import __builtin__
            fp = __builtin__.open(fp, "wb")
            close = 1
        else:
            close = 0

        try:
            save_handler(self, fp, filename)
        finally:
            # do what we can to clean up
            if close:
                fp.close()

    ##
    # Seeks to the given frame in this sequence file. If you seek
    # beyond the end of the sequence, the method raises an
    # <b>EOFError</b> exception. When a sequence file is opened, the
    # library automatically seeks to frame 0.
    # <p>
    # Note that in the current version of the library, most sequence
    # formats only allows you to seek to the next frame.
    #
    # @param frame Frame number, starting at 0.
    # @exception EOFError If the call attempts to seek beyond the end
    #     of the sequence.
    # @see #Image.tell
Save image to file or stream
dataset/ETHPy150Open kleientertainment/ds_mod_tools/pkg/win32/Python27/Lib/site-packages/PIL/Image.py/Image.save