Documentation
¶
Overview ¶
Package colour provides methods for working with colour profiles.
Index ¶
- Constants
- func ColorSpace(r io.Reader) (uint16, error)
- func ICCProfileDescription(r io.Reader) (string, error)
- func NewAdobeRGBTransformation(ctx context.Context, uri string) (transform.Transformation, error)
- func NewDisplayP3Transformation(ctx context.Context, uri string) (transform.Transformation, error)
- func ToAdobeRGB(im image.Image) image.Image
- func ToDisplayP3(im image.Image) image.Image
- type AdobeRGBTransformation
- type DisplayP3Transformation
- type Model
Constants ¶
const ARGB_MODEL string = "Adobe RGB"
ARGB_MODEL defines the Adobe RGB colour model.
const COLORSPACE_ARGB uint16 = 2
COLORSPACE_ARGB is the EXIF value for the Adobe RGB colorspace.
const COLORSPACE_SRGB uint16 = 1
COLORSPACE_SRGB is the EXIF value for the sRGB colorspace.
const COLORSPACE_UNKNOWN uint16 = 65535
COLORSPACE_UNKNOWN is the EXIF value for unknown or undefined colorspaces.
const DISPLAYP3_MODEL string = "DisplayP3"
DISPLAYP3_MODEL defines the Apple DisplayP3 colour model
const ICC_ADOBE_RGB_1998 string = "Adobe RGB (1998)"
ICC_ADOBE_RGB_1998 is the ICC profile description for the Adobe RGB (1998) profile.
const ICC_CAMERA_RGB string = "Camera RGB Profile"
ICC_CAMERA_RGB is the ICC profile description for the Camera RGB Profile profile.
const ICC_DISPLAY_P3 string = "Display P3"
ICC_DISPLAY_P3 is the ICC profile description for the Apple Display P3 profile.
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.
const ICC_GENERIC_GRAY string = "Generic Gray Profile"
ICC_GENERIC_GRAY is the ICC profile description for the Generic Gray Profile profile.
const ICC_SRGB_21 string = "sRGB IEC61966-2.1"
ICC_SRGB_21 is the ICC profile description for the sRGB IEC61966-2.1 profile.
const SRGB_MODEL string = "sRGB"
SRGB_MODEL defines the sRGB colour space/model.
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
ColorSpace attempts to derive the EXIF ColorSpace value from the body of 'r'.
func ICCProfileDescription ¶ added in v1.3.0
ICCProfileDescription attempts to the derive the ICC profile description from the body of 'r'
func NewAdobeRGBTransformation ¶
NewAdobeRGBTransformation returns a new `AdobeRGBTransformationTransformation` instance configured by 'uri' which is expected to take the form of:
adobergb://
func NewDisplayP3Transformation ¶
NewDisplayp3Transformation returns a new `Displayp3TransformationTransformation` instance configured by 'uri' which is expected to take the form of:
displayp3://
func ToAdobeRGB ¶
ToAdobeRGB converts all the colours in 'im' to match the Adobe RGB 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.
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.
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
StringToModel returns the `Model` instance matching 'str_model'.