Documentation
¶
Overview ¶
Package cms converts the colors of a decoded image to sRGB, with the icc package of ivy (D57).
A decoder gives the ICC profile that its file embeds, or the CICP code points of the file. An image that is sRGB already, or whose file gives no color space, is returned as it is. An image with the PQ or the HLG transfer of HDR is returned as it is too, because the icc package does no tone mapping, and the image would look dark. A CMYK image with no profile is converted with the default CMYK profile of ivy.
Index ¶
- func CICP(primaries, transfer, matrix uint16, fullRange bool) (*icc.CICP, bool)
- func Convert(ctx context.Context, img image.Image, profile []byte, c *icc.CICP) (image.Image, error)
- func ConvertAll(ctx context.Context, frames []image.Image, profile []byte, c *icc.CICP) ([]image.Image, error)
- func Description(profile []byte) string
- func JPEGProfile(buf []byte) []byte
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CICP ¶
CICP returns the code points of a file as an icc.CICP, and false when one of them is not a code point.
func Convert ¶
func Convert(ctx context.Context, img image.Image, profile []byte, c *icc.CICP) (image.Image, error)
Convert returns img in sRGB. profile is the ICC profile that the file of img embeds, and c holds the CICP code points of the file, when it has them. The profile wins over the code points.
A profile or code points that the icc package cannot use leave img as it is, with a warning. Convert returns an error only when ctx is done.
func ConvertAll ¶
func ConvertAll(ctx context.Context, frames []image.Image, profile []byte, c *icc.CICP) ([]image.Image, error)
ConvertAll converts each frame of an animation, as Convert does.
func Description ¶
Description returns the description of the ICC profile, such as "Display P3", or an empty string when the profile has none. A profile of version 2 holds it as a textDescriptionType, in ASCII, and a profile of version 4 as a multiLocalizedUnicodeType, in UTF-16, of which the first record is taken.
func JPEGProfile ¶
JPEGProfile returns the ICC profile that the JPEG in buf embeds, or nil. A profile is stored in APP2 segments that start with ICC_PROFILE, then the number of the segment and the count of the segments, each from 1. The segments come before the first scan.
Types ¶
This section is empty.