Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6a362e4

Browse files
committed
Merge pull request #970 from cgohlke/master
Fix tiff and jpeg export via PIL
2 parents a52a350 + b1cbbd1 commit 6a362e4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/matplotlib/backend_bases.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1883,7 +1883,7 @@ def print_jpg(self, filename_or_obj, *args, **kwargs):
18831883
image = Image.frombuffer('RGBA', size, buf, 'raw', 'RGBA', 0, 1)
18841884
options = cbook.restrict_dict(kwargs, ['quality', 'optimize',
18851885
'progressive'])
1886-
return image.save(filename_or_obj, **options)
1886+
return image.save(filename_or_obj, format='jpeg', **options)
18871887
print_jpeg = print_jpg
18881888

18891889
filetypes['tif'] = filetypes['tiff'] = 'Tagged Image File Format'
@@ -1893,7 +1893,7 @@ def print_tif(self, filename_or_obj, *args, **kwargs):
18931893
buf, size = agg.print_to_buffer()
18941894
if kwargs.pop("dryrun", False): return
18951895
image = Image.frombuffer('RGBA', size, buf, 'raw', 'RGBA', 0, 1)
1896-
return image.save(filename_or_obj)
1896+
return image.save(filename_or_obj, format='tiff')
18971897
print_tiff = print_tif
18981898

18991899
def get_supported_filetypes(self):

0 commit comments

Comments
 (0)