diff --git a/PIL/Image.py b/PIL/Image.py index 40a467d12..359aae716 100644 --- a/PIL/Image.py +++ b/PIL/Image.py @@ -505,8 +505,11 @@ class Image: def _dump(self, file=None, format=None): import tempfile, os + suffix = '' + if format: + suffix = '.'+format if not file: - f, file = tempfile.mkstemp(format or '') + f, file = tempfile.mkstemp(suffix) os.close(f) self.load()