Instance Propertyswift-png 4.4.5PNG

    depth

    The bit depth of an image with this pixel format.

    PNG.Format.Pixel.swift:201
    var depth: Int { get }

    This number is not the color depth the encoded image; it indicates the bit depth of the stored image data. Notably, indexed images always have a color depth of 8, even though they may have a bit depth less than 8.

    This property returns 1 for the v1 and indexed1 pixel formats.

    This property returns 2 for the v2 and indexed2 pixel formats.

    This property returns 4 for the v4 and indexed4 pixel formats.

    This property returns 8 for the v8, va8, indexed8, rgb8, and rgba8 pixel formats.

    This property returns 16 for the v16, va16, rgb16, and rgba16 pixel formats.

    Other members in extension

    Instance members

    • var channels: Int

      The number of channels encoded per-pixel in the internal representation of an image with this pixel format.

    • var hasAlpha: Bool

      Indicates whether an image with this pixel format contains an alpha component.

    • var hasColor: Bool

      Indicates whether an image with this pixel format contains more than one non-alpha color component.