- optimize : bool
(Only available in PNG-PIL)
If present and true, instructs the PNG writer to make the output file
as small as possible. This includes extra processing in order to find
optimal encoder settings.
- transparency:
(Only available in PNG-PIL)
This option controls what color image to mark as transparent.
- dpi: tuple of two scalars
(Only available in PNG-PIL)
The desired dpi in each direction.
- pnginfo: PIL.PngImagePlugin.PngInfo
(Only available in PNG-PIL)
Object containing text tags.
- compress_level: int
(Only available in PNG-PIL)
ZLIB compression level, a number between 0 and 9: 1 gives best speed,
9 gives best compression, 0 gives no compression at all. Default is 9.
When optimize option is True compress_level has no effect
(it is set to 9 regardless of a value passed).
- compression: int
(Only available in PNG-PIL)
Compatibility with the freeimage PNG format. If given, it overrides
compress_level.
- icc_profile:
(Only available in PNG-PIL)
The ICC Profile to include in the saved file.
- bits (experimental): int
(Only available in PNG-PIL)
This option controls how many bits to store. If omitted,
the PNG writer uses 8 bits (256 colors).
- quantize:
(Only available in PNG-PIL)
Compatibility with the freeimage PNG format. If given, it overrides
bits. In this case, given as a number between 1-256.
- dictionary (experimental): dict
(Only available in PNG-PIL)
Set the ZLIB encoder dictionary.
- prefer_uint8: bool
(Only available in PNG-PIL)
Let the PNG writer truncate uint16 image arrays to uint8 if their values fall
within the range [0, 255]. Defaults to true for legacy compatibility, however
it is recommended to set this to false to avoid unexpected behavior when
saving e.g. weakly saturated images.
- quality : scalar
(Only available in JPEG-PIL)
The compression factor of the saved image (1..100), higher
numbers result in higher quality but larger file size. Default 75.
- progressive : bool
(Only available in JPEG-PIL)
Save as a progressive JPEG file (e.g. for images on the web).
Default False.
- optimize : bool
(Only available in JPEG-PIL)
On saving, compute optimal Huffman coding tables (can reduce a few
percent of file size). Default False.
- dpi : tuple of int
(Only available in JPEG-PIL)
The pixel density, (x,y).
- icc_profile : object
(Only available in JPEG-PIL)
If present and true, the image is stored with the provided ICC profile.
If this parameter is not provided, the image will be saved with no
profile attached.
- exif : dict
(Only available in JPEG-PIL)
If present, the image will be stored with the provided raw EXIF data.
- subsampling : str
(Only available in JPEG-PIL)
Sets the subsampling for the encoder. See Pillow docs for details.
- qtables : object
(Only available in JPEG-PIL)
Set the qtables for the encoder. See Pillow docs for details.
- quality_mode : str
(Only available in JPEG2000-PIL)
Either “rates” or “dB” depending on the units you want to use to
specify image quality.
- quality : float
(Only available in JPEG2000-PIL)
Approximate size reduction (if quality mode is rates) or a signal to noise ratio
in decibels (if quality mode is dB).
- loop : int
(Only available in GIF-PIL)
The number of iterations. Default 0 (meaning loop indefinitely).
- duration : {float, list}
(Only available in GIF-PIL)
The duration (in milliseconds) of each frame. Either specify one value
that is used for all frames, or one value for each frame.
- fps : float
(Only available in GIF-PIL)
The number of frames per second. If duration is not given, the
duration for each frame is set to 1/fps. Default 10.
- palettesize : int
(Only available in GIF-PIL)
The number of colors to quantize the image to. Is rounded to
the nearest power of two. Default 256.
- subrectangles : bool
(Only available in GIF-PIL)
If True, will try and optimize the GIF by storing only the
rectangular parts of each frame that change with respect to the
previous. Default False.