parameters: (self, quality=0, output_format='')
return_statement: return image_apply_opt(output_image, **opt)
docstring: Return the image resulting of all the image processing
          operations that have been applied previously.
  
          Return False if the initialized `image` was falsy, and return
          the initialized `image` without change if it was SVG.
  
          Also return the initialized `image` if no operations have been applied
          and the `output_format` is the same as the original format and the
          quality is not specified.
  
          :param quality: quality setting to apply. Default to 0.
              - for JPEG: 1 is worse, 95 is best. Values above 95 should be
                  avoided. Falsy values will fallback to 95, but only if the image
                  was changed, otherwise the original image is returned.
              - for PNG: set falsy to prevent conversion to a WEB palette.
              - for other formats: no effect.
          :type quality: int
  
          :param output_format: the output format. Can be PNG, JPEG, GIF, or ICO.
              Default to the format of the original image. BMP is converted to
              PNG, other formats than those mentioned above are converted to JPEG.
          :type output_format: string
  
          :return: image
          :rtype: bytes or False
docstring_summary: Return the image resulting of all the image processing
          operations that have been applied previously.
docstring_tokens: Return the image resulting of all the image processing operations that have been applied previously .
function: def image_quality(self, quality=0, output_format=''):
          """Return the image resulting of all the image processing
          operations that have been applied previously.
  
          Return False if the initialized `image` was falsy, and return
          the initialized `image` without change if it was SVG.
  
          Also return the initialized `image` if no operations have been applied
          and the `output_format` is the same as the original format and the
          quality is not specified.
  
          :param quality: quality setting to apply. Default to 0.
              - for JPEG: 1 is worse, 95 is best. Values above 95 should be
                  avoided. Falsy values will fallback to 95, but only if the image
                  was changed, otherwise the original image is returned.
              - for PNG: set falsy to prevent conversion to a WEB palette.
              - for other formats: no effect.
          :type quality: int
  
          :param output_format: the output format. Can be PNG, JPEG, GIF, or ICO.
              Default to the format of the original image. BMP is converted to
              PNG, other formats than those mentioned above are converted to JPEG.
          :type output_format: string
  
          :return: image
          :rtype: bytes or False
          """
          if not self.image:
              return self.image
  
          output_image = self.image
  
          output_format = output_format.upper() or self.original_format
          if output_format == 'BMP':
              output_format = 'PNG'
          elif output_format not in ['PNG', 'JPEG', 'GIF', 'ICO']:
              output_format = 'JPEG'
  
          if not self.operationsCount and output_format == self.original_format and not quality:
              return self.image
  
          opt = {'format': output_format}
  
          if output_format == 'PNG':
              opt['optimize'] = True
              if quality:
                  if output_image.mode != 'P':
                      # Floyd Steinberg dithering by default
                      output_image = output_image.convert('RGBA').convert('P', palette=Image.WEB, colors=256)
          if output_format == 'JPEG':
              opt['optimize'] = True
              opt['quality'] = quality or 95
          if output_format == 'GIF':
              opt['optimize'] = True
              opt['save_all'] = True
  
          if output_image.mode not in ["1", "L", "P", "RGB", "RGBA"] or (output_format == 'JPEG' and output_image.mode == 'RGBA'):
              output_image = output_image.convert("RGB")
  
          return image_apply_opt(output_image, **opt)
function_tokens: def image_quality ( self , quality = 0 , output_format = '' ) : if not self . image : return self . image output_image = self . image output_format = output_format . upper ( ) or self . original_format if output_format == 'BMP' : output_format = 'PNG' elif output_format not in [ 'PNG' , 'JPEG' , 'GIF' , 'ICO' ] : output_format = 'JPEG' if not self . operationsCount and output_format == self . original_format and not quality : return self . image opt = { 'format' : output_format } if output_format == 'PNG' : opt [ 'optimize' ] = True if quality : if output_image . mode != 'P' : # Floyd Steinberg dithering by default output_image = output_image . convert ( 'RGBA' ) . convert ( 'P' , palette = Image . WEB , colors = 256 ) if output_format == 'JPEG' : opt [ 'optimize' ] = True opt [ 'quality' ] = quality or 95 if output_format == 'GIF' : opt [ 'optimize' ] = True opt [ 'save_all' ] = True if output_image . mode not in [ "1" , "L" , "P" , "RGB" , "RGBA" ] or ( output_format == 'JPEG' and output_image . mode == 'RGBA' ) : output_image = output_image . convert ( "RGB" ) return image_apply_opt ( output_image , * * opt )