:orphan: .. _ICNS-PIL: ICNS-PIL Mac OS icns resource ============================= Extensions: ``.icns`` *From the Pillow docs:* PIL reads and (macOS only) writes macOS ``.icns`` files. By default, the largest available icon is read, though you can override this by setting the :py:attr:`~PIL.Image.Image.size` property before calling :py:meth:`~PIL.Image.Image.load`. The :py:meth:`~PIL.Image.Image.write` method sets the following :py:attr:`~PIL.Image.Image.info` property: **sizes** A list of supported sizes found in this icon file; these are a 3-tuple, ``(width, height, scale)``, where ``scale`` is 2 for a retina icon and 1 for a standard icon. You *are* permitted to use this 3-tuple format for the :py:attr:`~PIL.Image.Image.size` property if you set it before calling :py:meth:`~PIL.Image.Image.load`; after loading, the size will be reset to a 2-tuple containing pixel dimensions (so, e.g. if you ask for ``(512, 512, 2)``, the final value of :py:attr:`~PIL.Image.Image.size` will be ``(1024, 1024)``). Parameters for reading ---------------------- 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'.
Generated by dwww version 1.14 on Fri Sep 19 01:03:52 CEST 2025.