Skip to content

Latest commit

 

History

History
110 lines (84 loc) · 4.6 KB

Profile.md

File metadata and controls

110 lines (84 loc) · 4.6 KB

The Profile class Loads and decodes ICC Profiles without performing color conversions.

  • Capability to handle profiles from various sources, such as binary arrays, URLs, base64 encoded strings, or creating virtual profiles like sRGB or Adobe RGB.
  • Support for both ICC Profile versions 2 and 4.
  • Compatibility with various profile types, including RGB, Gray, Lab, and CMYK. RGB profiles can be either matrix-based or LUT-based.

Note

the Profile class does not perform color conversions. For this purpose, use the Transform class.

Profile Methods

profile.load(dataOrUrl, afterLoad)

Loads a profile from various sources like Uint8Array, URL, base64 string, file path, or virtual profile.

  • dataOrUrl:
    • Uint8Array
    • Base64: prefix with 'data:'
    • URL/File Path: prefix with 'file:'
    • Virtual Profile Name: prefix with '*'
  • afterLoad: callback function(profile)

profile.loadPromise(dataOrUrl)

Returns a Promise that resolves after loading a profile.

  • dataOrUrl:
    • Uint8Array
    • Base64: prefix with 'data:'
    • URL/File Path: prefix with 'file:'
    • Virtual Profile Name: prefix with '*'

profile.loadBinary(binary, afterLoad, searchForProfile)

Loads a profile from a binary array, optionally searching for the ICC profile within the array.

  • binary: Uint8Array
  • afterLoad: callback function(profile)
  • searchForProfile: Boolean

profile.loadFile(filename, afterLoad)

Loads a profile from a local file path. (In nodeJS)

  • filename: String
  • afterLoad: callback function(profile)

profile.loadBase64(base64, afterLoad)

Loads a profile from a base64 encoded string.

  • base64: String
  • afterLoad : callback function(profile)

profile.loadURL(url, afterLoad)

Loads a profile from a URL using an XHR request.

  • url: String
  • afterLoad: callback function(profile)

profile.loadVirtualProfile(name)

Creates and loads a virtual profile, such as sRGB, Adobe RGB, Lab D50, etc.

  • name: String (see table below)
Name Description
*sRGB sRGB
*AdobeRGB Adobe RGB (1998)
*AppleRGB Apple RGB
*ColorMatchRGB ColorMatch RGB
*ProPhotoRGB ProPhoto RGB
*Lab Lab D50*
*LabD50 Lab D50*
*LabD65 Lab D65*

** Note that Lab profiles are abstract profiles, and according to the ICC specification the engine will not perform chromatic adaptation when converting

This table provides an overview of the functions available in the Profile class, excluding internal private methods. Each function's purpose and its parameters are clearly outlined.

Profile Properties

List of useful properties of the Profile class.

Property Type Description
loaded Boolean Indicates if the profile has been successfully loaded.
lastError Object Contains the last error information.
type Integer Type of the profile (e.g., RGB, CMYK, Gray).
name String Name of the profile.
header Object Contains header information of the ICC profile.
intent Integer Default Rendering intent for the profile.
description String Description of the profile.
copyright String Copyright information of the profile.
technology String Information about the technology of the profile.
mediaWhitePoint Object Media white point data.
outputChannels Integer Number of output channels.