Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tiff and jpeg export via PIL #970

Merged
merged 1 commit into from
Jul 1, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/matplotlib/backend_bases.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -1883,7 +1883,7 @@ def print_jpg(self, filename_or_obj, *args, **kwargs):
image = Image.frombuffer('RGBA', size, buf, 'raw', 'RGBA', 0, 1) image = Image.frombuffer('RGBA', size, buf, 'raw', 'RGBA', 0, 1)
options = cbook.restrict_dict(kwargs, ['quality', 'optimize', options = cbook.restrict_dict(kwargs, ['quality', 'optimize',
'progressive']) 'progressive'])
return image.save(filename_or_obj, **options) return image.save(filename_or_obj, format='jpeg', **options)
print_jpeg = print_jpg print_jpeg = print_jpg


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


def get_supported_filetypes(self): def get_supported_filetypes(self):
Expand Down