8000 Added savefig.jpeg_quality to the rcParams correctly · cirosantilli/matplotlib@e1c2378 · GitHub
[go: up one dir, main page]

Skip to content

Commit e1c2378

Browse files
author
Daniel Hyams
committed
Added savefig.jpeg_quality to the rcParams correctly
With a short one-line doc in matplotlibrc.template.
1 parent 3abd91e commit e1c2378

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

lib/matplotlib/backend_bases.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1952,7 +1952,7 @@ def print_jpg(self, filename_or_obj, *args, **kwargs):
19521952
'progressive'])
19531953

19541954
if 'quality' not in options:
1955-
options['quality'] = rcParams.get('savefig.jpeg_quality',95)
1955+
options['quality'] = rcParams['savefig.jpeg_quality']
19561956

19571957
return image.save(filename_or_obj, format='jpeg', **options)
19581958
print_jpeg = print_jpg

lib/matplotlib/rcsetup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -687,6 +687,7 @@ def __call__(self, s):
687687
'savefig.frameon': [True, validate_bool],
688688
'savefig.orientation': ['portrait', validate_orientation], # edgecolor;
689689
#white
690+
'savefig.jpeg_quality': [95, validate_int],
690691
# what to add to extensionless filenames
691692
'savefig.extension': ['png', deprecate_savefig_extension],
692693
# value checked by backend at runtime

matplotlibrc.template

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -362,14 +362,15 @@ text.hinting_factor : 8 # Specifies the amount of softness for hinting in the
362362
# the default savefig params can be different from the display params
363363
# e.g., you may want a higher resolution, or to make the figure
364364
# background white
365-
#savefig.dpi : 100 # figure dots per inch
366-
#savefig.facecolor : white # figure facecolor when saving
367-
#savefig.edgecolor : white # figure edgecolor when saving
368-
#savefig.format : png # png, ps, pdf, svg
369-
#savefig.bbox : standard # 'tight' or 'standard'.
370-
#savefig.pad_inches : 0.1 # Padding to be used when bbox is set to 'tight'
371-
#savefig.directory : ~ # default directory in savefig dialog box,
372-
# leave empty to always use current working directory
365+
#savefig.dpi : 100 # figure dots per inch
366+
#savefig.facecolor : white # figure facecolor when saving
367+
#savefig.edgecolor : white # figure edgecolor when saving
368+
#savefig.format : png # png, ps, pdf, svg
369+
#savefig.bbox : standard # 'tight' or 'standard'.
370+
#savefig.pad_inches : 0.1 # Padding to be used when bbox is set to 'tight'
371+
#savefig.jpeg_quality: 95 # when a jpeg is saved, the default quality parameter.
372+
#savefig.directory : ~ # default directory in savefig dialog box,
373+
# leave empty to always use current working directory
373374

374375
# tk backend params
375376
#tk.window_focus : False # Maintain shell focus for TkAgg

0 commit comments

Comments
 (0)
0