cms

package
v0.24.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 28, 2026 License: MIT Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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.

See: https://github.com/xo/ivy

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CICP

func CICP(primaries, transfer, matrix uint16, fullRange bool) (*icc.CICP, bool)

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

func Description(profile []byte) string

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

func JPEGProfile(buf []byte) []byte

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL