@@ -522,14 +522,7 @@ def print_to_buffer(self):
522522 # print_figure(), and the latter ensures that `self.figure.dpi` already
523523 # matches the dpi kwarg (if any).
524524
525- @_check_savefig_extra_args (
526- extra_kwargs = ["quality" , "optimize" , "progressive" ])
527- @_api .delete_parameter ("3.3" , "quality" ,
528- alternative = "pil_kwargs={'quality': ...}" )
529- @_api .delete_parameter ("3.3" , "optimize" ,
530- alternative = "pil_kwargs={'optimize': ...}" )
531- @_api .delete_parameter ("3.3" , "progressive" ,
532- alternative = "pil_kwargs={'progressive': ...}" )
525+ @_check_savefig_extra_args ()
533526 @_api .delete_parameter ("3.5" , "args" )
534527 def print_jpg (self , filename_or_obj , * args , pil_kwargs = None , ** kwargs ):
535528 """
@@ -542,23 +535,9 @@ def print_jpg(self, filename_or_obj, *args, pil_kwargs=None, **kwargs):
542535
543536 Other Parameters
544537 ----------------
545- quality : int, default: :rc:`savefig.jpeg_quality`
546- The image quality, on a scale from 1 (worst) to 95 (best).
547- Values above 95 should be avoided; 100 disables portions of
548- the JPEG compression algorithm, and results in large files
549- with hardly any gain in image quality. This parameter is
550- deprecated.
551- optimize : bool, default: False
552- Whether the encoder should make an extra pass over the image
553- in order to select optimal encoder settings. This parameter is
554- deprecated.
555- progressive : bool, default: False
556- Whether the image should be stored as a progressive JPEG file.
557- This parameter is deprecated.
558538 pil_kwargs : dict, optional
559539 Additional keyword arguments that are passed to
560- `PIL.Image.Image.save` when saving the figure. These take
561- precedence over *quality*, *optimize* and *progressive*.
540+ `PIL.Image.Image.save` when saving the figure.
562541 """
563542 # Remove transparency by alpha-blending on an assumed white background.
564543 r , g , b , a = mcolors .to_rgba (self .figure .get_facecolor ())
@@ -569,19 +548,6 @@ def print_jpg(self, filename_or_obj, *args, pil_kwargs=None, **kwargs):
569548 self .figure .set_facecolor ((r , g , b , a ))
570549 if pil_kwargs is None :
571550 pil_kwargs = {}
572- for k in ["quality" , "optimize" , "progressive" ]:
573- if k in kwargs :
574- pil_kwargs .setdefault (k , kwargs .pop (k ))
575- if "quality" not in pil_kwargs :
576- quality = pil_kwargs ["quality" ] = \
577- dict .__getitem__ (mpl .rcParams , "savefig.jpeg_quality" )
578- if quality not in [0 , 75 , 95 ]: # default qualities.
579- _api .warn_deprecated (
580- "3.3" , name = "savefig.jpeg_quality" , obj_type = "rcParam" ,
581- addendum = "Set the quality using "
582- "`pil_kwargs={'quality': ...}`; the future default "
583- "quality will be 75, matching the default of Pillow and "
584- "libjpeg." )
585551 pil_kwargs .setdefault ("dpi" , (self .figure .dpi , self .figure .dpi ))
586552 # Drop alpha channel now.
587553 return (Image .fromarray (np .asarray (self .buffer_rgba ())[..., :3 ])
0 commit comments