colour

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2024 License: BSD-3-Clause Imports: 13 Imported by: 5

Documentation

Overview

Package colour provides methods for working with colour profiles.

Index

Constants

View Source
const ARGB_MODEL string = "Adobe RGB"

ARGB_MODEL defines the Adobe RGB colour model.

View Source
const COLORSPACE_ARGB uint16 = 2

COLORSPACE_ARGB is the EXIF value for the Adobe RGB colorspace.

View Source
const COLORSPACE_SRGB uint16 = 1

COLORSPACE_SRGB is the EXIF value for the sRGB colorspace.

View Source
const COLORSPACE_UNKNOWN uint16 = 65535

COLORSPACE_UNKNOWN is the EXIF value for unknown or undefined colorspaces.

View Source
const DISPLAYP3_MODEL string = "DisplayP3"

DISPLAYP3_MODEL defines the Apple DisplayP3 colour model

View Source
const ICC_ADOBE_RGB_1998 string = "Adobe RGB (1998)"

ICC_ADOBE_RGB_1998 is the ICC profile description for the Adobe RGB (1998) profile.

View Source
const ICC_CAMERA_RGB string = "Camera RGB Profile"

ICC_CAMERA_RGB is the ICC profile description for the Camera RGB Profile profile.

View Source
const ICC_DISPLAY_P3 string = "Display P3"

ICC_DISPLAY_P3 is the ICC profile description for the Apple Display P3 profile.

View Source
const ICC_EPSON_RGB_G18 string = "EPSON  Standard RGB - Gamma 1.8"

ICC_EPSON_RGB_G18 is the ICC profile description for the EPSON Standard RGB - Gamma 1.8 profile.

View Source
const ICC_GENERIC_GRAY string = "Generic Gray Profile"

ICC_GENERIC_GRAY is the ICC profile description for the Generic Gray Profile profile.

View Source
const ICC_SRGB_21 string = "sRGB IEC61966-2.1"

ICC_SRGB_21 is the ICC profile description for the sRGB IEC61966-2.1 profile.

View Source
const SRGB_MODEL string = "sRGB"

SRGB_MODEL defines the sRGB colour space/model.

View Source
const UNKNOWN_MODEL string = "unknown"

UNKNOWN_MODEL defines an unknown or unspecified colour model.

Variables

This section is empty.

Functions

func ColorSpace added in v1.3.0

func ColorSpace(r io.Reader) (uint16, error)

ColorSpace attempts to derive the EXIF ColorSpace value from the body of 'r'.

func ICCProfileDescription added in v1.3.0

func ICCProfileDescription(r io.Reader) (string, error)

ICCProfileDescription attempts to the derive the ICC profile description from the body of 'r'

func NewAdobeRGBTransformation

func NewAdobeRGBTransformation(ctx context.Context, uri string) (transform.Transformation, error)

NewAdobeRGBTransformation returns a new `AdobeRGBTransformationTransformation` instance configured by 'uri' which is expected to take the form of:

adobergb://

func NewDisplayP3Transformation

func NewDisplayP3Transformation(ctx context.Context, uri string) (transform.Transformation, error)

NewDisplayp3Transformation returns a new `Displayp3TransformationTransformation` instance configured by 'uri' which is expected to take the form of:

displayp3://

func ToAdobeRGB

func ToAdobeRGB(im image.Image) image.Image

ToAdobeRGB converts all the colours in 'im' to match the Adobe RGB colour profile.

func ToDisplayP3

func ToDisplayP3(im image.Image) image.Image

ToDisplayP3 converts all the coloura in 'im' to match the Apple Display P3 colour profile.

Types

type AdobeRGBTransformation

type AdobeRGBTransformation struct {
	transform.Transformation
}

AdobeRGBTransformation implements the `transform.Transformation` interface for converting all the colours in an image to match the Adobe RGB colour profile.

func (*AdobeRGBTransformation) Transform

func (tr *AdobeRGBTransformation) Transform(ctx context.Context, im image.Image) (image.Image, error)

Transform converts all the colours in 'im' to match the Adobe RGB colour profile.

type DisplayP3Transformation

type DisplayP3Transformation struct {
	transform.Transformation
}

Displayp3Transformation implements the `transform.Transformation` interface for converting all the colours in an image to match the Apple Display P3 colour profile.

func (*DisplayP3Transformation) Transform

func (tr *DisplayP3Transformation) Transform(ctx context.Context, im image.Image) (image.Image, error)

Transform converts all the colours in 'im' to match the Apple Display P3 colour profile.

type Model added in v1.3.0

type Model uint8

type Model defines an internal catalog of colour "models" for Go language image pixels. Models are derived from ICC profile descriptions and EXIF ColorSpace definitions in that order. The goal of these models is to provide hints to other applications which may need or want to recast the colour space of individual pixels in Go language `image.Image` instances. Currently there are only four "known" models: Apple's Display P3, Adobe RGB, sRGB and unknown.

const (
	// The unknown or undefined colour model.
	UnknownModel Model = iota
	// The colour model corresponding to the sRGB colour space.
	SRGBModel
	// The colour model corresponding to the Adobe RGB colour space.
	AdobeRGBModel
	// The colour model corresponding to the Apple Display P3 colour space.
	AppleDisplayP3Model
)

func DeriveModel added in v1.3.0

func DeriveModel(r io.ReadSeeker) (Model, error)

DeriveModel attempts to derive a `Model` instance from the body of 'r' by checking for an ICC profile description or a EXIF ColorSpace definition, in that order.

func StringToModel added in v1.3.0

func StringToModel(str_model string) Model

StringToModel returns the `Model` instance matching 'str_model'.

func (Model) String added in v1.3.0

func (p Model) String() string

Jump to

Keyboard shortcuts

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