:orphan: .. _PNG-PIL: PNG-PIL Portable network graphics ================================= Extensions: ``.png`` A PNG format based on Pillow. This format supports grayscale, RGB and RGBA images. Parameters for reading ---------------------- ignoregamma : bool Avoid gamma correction. Default True. pilmode : str From the Pillow documentation: * 'L' (8-bit pixels, grayscale) * 'P' (8-bit pixels, mapped to any other mode using a color palette) * 'RGB' (3x8-bit pixels, true color) * 'RGBA' (4x8-bit pixels, true color with transparency mask) * 'CMYK' (4x8-bit pixels, color separation) * 'YCbCr' (3x8-bit pixels, color video format) * 'I' (32-bit signed integer pixels) * 'F' (32-bit floating point pixels) PIL also provides limited support for a few special modes, including 'LA' ('L' with alpha), 'RGBX' (true color with padding) and 'RGBa' (true color with premultiplied alpha). When translating a color image to grayscale (mode 'L', 'I' or 'F'), the library uses the ITU-R 601-2 luma transform:: L = R * 299/1000 + G * 587/1000 + B * 114/1000 as_gray : bool If True, the image is converted using mode 'F'. When `mode` is not None and `as_gray` is True, the image is first converted according to `mode`, and the result is then "flattened" using mode 'F'. Parameters for saving --------------------- optimize : bool 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: This option controls what color image to mark as transparent. dpi: tuple of two scalars The desired dpi in each direction. pnginfo: PIL.PngImagePlugin.PngInfo Object containing text tags. compress_level: int 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 Compatibility with the freeimage PNG format. If given, it overrides compress_level. icc_profile: The ICC Profile to include in the saved file. bits (experimental): int This option controls how many bits to store. If omitted, the PNG writer uses 8 bits (256 colors). quantize: Compatibility with the freeimage PNG format. If given, it overrides bits. In this case, given as a number between 1-256. dictionary (experimental): dict Set the ZLIB encoder dictionary.
Generated by dwww version 1.14 on Thu Sep 18 23:38:55 CEST 2025.