java.awt.color

Class ICC_Profile

public class ICC_Profile extends Object implements Serializable

ICC Profile - represents an ICC Color profile. The ICC profile format is a standard file format which maps the transform from a device color space to a standard Profile Color Space (PCS), which can either be CIE L*a*b or CIE XYZ. (With the exception of device link profiles which map from one device space to another) ICC profiles calibrated to specific input/output devices are used when color fidelity is of importance. An instance of ICC_Profile can be created using the getInstance() methods, either using one of the predefined color spaces enumerated in ColorSpace, or from an ICC profile file, or from an input stream. An ICC_ColorSpace object can then be created to transform color values through the profile. The ICC_Profile class implements the version 2 format specified by International Color Consortium Specification ICC.1:1998-09, and its addendum ICC.1A:1999-04, April 1999 (available at www.color.org)

Since: 1.2

Field Summary
static intCLASS_ABSTRACT
static intCLASS_COLORSPACECONVERSION
static intCLASS_DEVICELINK
static intCLASS_DISPLAY
static intCLASS_INPUT
ICC Profile classes
static intCLASS_NAMEDCOLOR
static intCLASS_OUTPUT
static inticAbsoluteColorimetric
static inticCurveCount
static inticCurveData
static inticHdrAttributes
static inticHdrCmmId
static inticHdrColorSpace
static inticHdrCreator
static inticHdrDate
static inticHdrDeviceClass
static inticHdrFlags
static inticHdrIlluminant
static inticHdrMagic
static inticHdrManufacturer
static inticHdrModel
static inticHdrPcs
static inticHdrPlatform
static inticHdrRenderingIntent
static inticHdrSize
Header offsets
static inticHdrVersion
static inticPerceptual
Rendering intents
static inticRelativeColorimetric
static inticSaturation
static inticSigAbstractClass
static inticSigAToB0Tag
Tag signatures
static inticSigAToB1Tag
static inticSigAToB2Tag
static inticSigBlueColorantTag
static inticSigBlueTRCTag
static inticSigBToA0Tag
static inticSigBToA1Tag
static inticSigBToA2Tag
static inticSigCalibrationDateTimeTag
static inticSigCharTargetTag
static inticSigChromaticityTag
static inticSigCmyData
static inticSigCmykData
static inticSigColorSpaceClass
static inticSigCopyrightTag
static inticSigCrdInfoTag
static inticSigDeviceMfgDescTag
static inticSigDeviceModelDescTag
static inticSigDeviceSettingsTag
static inticSigDisplayClass
static inticSigGamutTag
static inticSigGrayData
static inticSigGrayTRCTag
static inticSigGreenColorantTag
static inticSigGreenTRCTag
static inticSigHead
Non-ICC tag 'head' for use in retrieving the header with getData()
static inticSigHlsData
static inticSigHsvData
static inticSigInputClass
ICC Profile class signatures
static inticSigLabData
static inticSigLinkClass
static inticSigLuminanceTag
static inticSigLuvData
static inticSigMeasurementTag
static inticSigMediaBlackPointTag
static inticSigMediaWhitePointTag
static inticSigNamedColor2Tag
static inticSigNamedColorClass
static inticSigOutputClass
static inticSigOutputResponseTag
static inticSigPreview0Tag
static inticSigPreview1Tag
static inticSigPreview2Tag
static inticSigProfileDescriptionTag
static inticSigProfileSequenceDescTag
static inticSigPs2CRD0Tag
static inticSigPs2CRD1Tag
static inticSigPs2CRD2Tag
static inticSigPs2CRD3Tag
static inticSigPs2CSATag
static inticSigPs2RenderingIntentTag
static inticSigRedColorantTag
static inticSigRedTRCTag
static inticSigRgbData
static inticSigScreeningDescTag
static inticSigScreeningTag
static inticSigSpace2CLR
static inticSigSpace3CLR
static inticSigSpace4CLR
static inticSigSpace5CLR
static inticSigSpace6CLR
static inticSigSpace7CLR
static inticSigSpace8CLR
static inticSigSpace9CLR
static inticSigSpaceACLR
static inticSigSpaceBCLR
static inticSigSpaceCCLR
static inticSigSpaceDCLR
static inticSigSpaceECLR
static inticSigSpaceFCLR
static inticSigTechnologyTag
static inticSigUcrBgTag
static inticSigViewingCondDescTag
static inticSigViewingConditionsTag
static inticSigXYZData
Color space signatures
static inticSigYCbCrData
static inticSigYxyData
static inticTagReserved
static inticTagType
static inticXYZNumberX
Method Summary
protected voidfinalize()
Free up the used memory.
intgetColorSpaceType()
Returns the color space of this profile, in terms of the color space constants defined in ColorSpace.
byte[]getData()
Returns the data corresponding to this ICC_Profile as a byte array.
byte[]getData(int tagSignature)
Returns the ICC profile tag data The non ICC-tag icSigHead is also permitted to request the header data.
static ICC_ProfilegetInstance(byte[] data)
Returns an ICC_Profile instance from a byte array of profile data.
static ICC_ProfilegetInstance(int cspace)
Returns an predefined ICC_Profile instance.
static ICC_ProfilegetInstance(String filename)
Returns an ICC_Profile instance from an ICC Profile file.
static ICC_ProfilegetInstance(InputStream in)
Returns an ICC_Profile instance from an InputStream.
intgetMajorVersion()
Returns the major version number
intgetMinorVersion()
Returns the minor version number.
intgetNumComponents()
Get the number of components in the profile's device color space.
intgetPCSType()
Returns the color space of this profile's Profile Connection Space (OCS) In terms of the color space constants defined in ColorSpace.
intgetProfileClass()
Returns the device class of this profile, (E.g.
protected ObjectreadResolve()
After deserializing we must determine if the class we want is really one of the more specialized ICC_ProfileRGB or ICC_ProfileGray classes.
voidsetData(int tagSignature, byte[] data)
Sets the ICC profile tag data.
voidwrite(String filename)
Writes the profile data to an ICC profile file.
voidwrite(OutputStream out)
Writes the profile data in ICC profile file-format to a stream.

Field Detail

CLASS_ABSTRACT

public static final int CLASS_ABSTRACT

CLASS_COLORSPACECONVERSION

public static final int CLASS_COLORSPACECONVERSION

CLASS_DEVICELINK

public static final int CLASS_DEVICELINK

CLASS_DISPLAY

public static final int CLASS_DISPLAY

CLASS_INPUT

public static final int CLASS_INPUT
ICC Profile classes

CLASS_NAMEDCOLOR

public static final int CLASS_NAMEDCOLOR

CLASS_OUTPUT

public static final int CLASS_OUTPUT

icAbsoluteColorimetric

public static final int icAbsoluteColorimetric

icCurveCount

public static final int icCurveCount

icCurveData

public static final int icCurveData

icHdrAttributes

public static final int icHdrAttributes

icHdrCmmId

public static final int icHdrCmmId

icHdrColorSpace

public static final int icHdrColorSpace

icHdrCreator

public static final int icHdrCreator

icHdrDate

public static final int icHdrDate

icHdrDeviceClass

public static final int icHdrDeviceClass

icHdrFlags

public static final int icHdrFlags

icHdrIlluminant

public static final int icHdrIlluminant

icHdrMagic

public static final int icHdrMagic

icHdrManufacturer

public static final int icHdrManufacturer

icHdrModel

public static final int icHdrModel

icHdrPcs

public static final int icHdrPcs

icHdrPlatform

public static final int icHdrPlatform

icHdrRenderingIntent

public static final int icHdrRenderingIntent

icHdrSize

public static final int icHdrSize
Header offsets

icHdrVersion

public static final int icHdrVersion

icPerceptual

public static final int icPerceptual
Rendering intents

icRelativeColorimetric

public static final int icRelativeColorimetric

icSaturation

public static final int icSaturation

icSigAbstractClass

public static final int icSigAbstractClass

icSigAToB0Tag

public static final int icSigAToB0Tag
Tag signatures

icSigAToB1Tag

public static final int icSigAToB1Tag

icSigAToB2Tag

public static final int icSigAToB2Tag

icSigBlueColorantTag

public static final int icSigBlueColorantTag

icSigBlueTRCTag

public static final int icSigBlueTRCTag

icSigBToA0Tag

public static final int icSigBToA0Tag

icSigBToA1Tag

public static final int icSigBToA1Tag

icSigBToA2Tag

public static final int icSigBToA2Tag

icSigCalibrationDateTimeTag

public static final int icSigCalibrationDateTimeTag

icSigCharTargetTag

public static final int icSigCharTargetTag

icSigChromaticityTag

public static final int icSigChromaticityTag

icSigCmyData

public static final int icSigCmyData

icSigCmykData

public static final int icSigCmykData

icSigColorSpaceClass

public static final int icSigColorSpaceClass

icSigCopyrightTag

public static final int icSigCopyrightTag

icSigCrdInfoTag

public static final int icSigCrdInfoTag

icSigDeviceMfgDescTag

public static final int icSigDeviceMfgDescTag

icSigDeviceModelDescTag

public static final int icSigDeviceModelDescTag

icSigDeviceSettingsTag

public static final int icSigDeviceSettingsTag

icSigDisplayClass

public static final int icSigDisplayClass

icSigGamutTag

public static final int icSigGamutTag

icSigGrayData

public static final int icSigGrayData

icSigGrayTRCTag

public static final int icSigGrayTRCTag

icSigGreenColorantTag

public static final int icSigGreenColorantTag

icSigGreenTRCTag

public static final int icSigGreenTRCTag

icSigHead

public static final int icSigHead
Non-ICC tag 'head' for use in retrieving the header with getData()

icSigHlsData

public static final int icSigHlsData

icSigHsvData

public static final int icSigHsvData

icSigInputClass

public static final int icSigInputClass
ICC Profile class signatures

icSigLabData

public static final int icSigLabData

icSigLinkClass

public static final int icSigLinkClass

icSigLuminanceTag

public static final int icSigLuminanceTag

icSigLuvData

public static final int icSigLuvData

icSigMeasurementTag

public static final int icSigMeasurementTag

icSigMediaBlackPointTag

public static final int icSigMediaBlackPointTag

icSigMediaWhitePointTag

public static final int icSigMediaWhitePointTag

icSigNamedColor2Tag

public static final int icSigNamedColor2Tag

icSigNamedColorClass

public static final int icSigNamedColorClass

icSigOutputClass

public static final int icSigOutputClass

icSigOutputResponseTag

public static final int icSigOutputResponseTag

icSigPreview0Tag

public static final int icSigPreview0Tag

icSigPreview1Tag

public static final int icSigPreview1Tag

icSigPreview2Tag

public static final int icSigPreview2Tag

icSigProfileDescriptionTag

public static final int icSigProfileDescriptionTag

icSigProfileSequenceDescTag

public static final int icSigProfileSequenceDescTag

icSigPs2CRD0Tag

public static final int icSigPs2CRD0Tag

icSigPs2CRD1Tag

public static final int icSigPs2CRD1Tag

icSigPs2CRD2Tag

public static final int icSigPs2CRD2Tag

icSigPs2CRD3Tag

public static final int icSigPs2CRD3Tag

icSigPs2CSATag

public static final int icSigPs2CSATag

icSigPs2RenderingIntentTag

public static final int icSigPs2RenderingIntentTag

icSigRedColorantTag

public static final int icSigRedColorantTag

icSigRedTRCTag

public static final int icSigRedTRCTag

icSigRgbData

public static final int icSigRgbData

icSigScreeningDescTag

public static final int icSigScreeningDescTag

icSigScreeningTag

public static final int icSigScreeningTag

icSigSpace2CLR

public static final int icSigSpace2CLR

icSigSpace3CLR

public static final int icSigSpace3CLR

icSigSpace4CLR

public static final int icSigSpace4CLR

icSigSpace5CLR

public static final int icSigSpace5CLR

icSigSpace6CLR

public static final int icSigSpace6CLR

icSigSpace7CLR

public static final int icSigSpace7CLR

icSigSpace8CLR

public static final int icSigSpace8CLR

icSigSpace9CLR

public static final int icSigSpace9CLR

icSigSpaceACLR

public static final int icSigSpaceACLR

icSigSpaceBCLR

public static final int icSigSpaceBCLR

icSigSpaceCCLR

public static final int icSigSpaceCCLR

icSigSpaceDCLR

public static final int icSigSpaceDCLR

icSigSpaceECLR

public static final int icSigSpaceECLR

icSigSpaceFCLR

public static final int icSigSpaceFCLR

icSigTechnologyTag

public static final int icSigTechnologyTag

icSigUcrBgTag

public static final int icSigUcrBgTag

icSigViewingCondDescTag

public static final int icSigViewingCondDescTag

icSigViewingConditionsTag

public static final int icSigViewingConditionsTag

icSigXYZData

public static final int icSigXYZData
Color space signatures

icSigYCbCrData

public static final int icSigYCbCrData

icSigYxyData

public static final int icSigYxyData

icTagReserved

public static final int icTagReserved

icTagType

public static final int icTagType

icXYZNumberX

public static final int icXYZNumberX

Method Detail

finalize

protected void finalize()
Free up the used memory.

getColorSpaceType

public int getColorSpaceType()
Returns the color space of this profile, in terms of the color space constants defined in ColorSpace. (For example, it may be a ColorSpace.TYPE_RGB)

getData

public byte[] getData()
Returns the data corresponding to this ICC_Profile as a byte array.

Returns: The data in a byte array, where the first element corresponds to first byte of the profile file.

getData

public byte[] getData(int tagSignature)
Returns the ICC profile tag data The non ICC-tag icSigHead is also permitted to request the header data.

Parameters: tagSignature The ICC signature of the requested tag

Returns: A byte array containing the tag data

getInstance

public static ICC_Profile getInstance(byte[] data)
Returns an ICC_Profile instance from a byte array of profile data. An instance of the specialized classes ICC_ProfileRGB or ICC_ProfileGray may be returned if appropriate.

Parameters: data - the profile data

Returns: An ICC_Profile object

Throws: IllegalArgumentException if the profile data is an invalid v2 profile.

getInstance

public static ICC_Profile getInstance(int cspace)
Returns an predefined ICC_Profile instance. This will construct an ICC_Profile instance from one of the predefined color spaces in the ColorSpace class. (e.g. CS_sRGB, CS_GRAY, etc) An instance of the specialized classes ICC_ProfileRGB or ICC_ProfileGray may be returned if appropriate.

Returns: An ICC_Profile object

getInstance

public static ICC_Profile getInstance(String filename)
Returns an ICC_Profile instance from an ICC Profile file. An instance of the specialized classes ICC_ProfileRGB or ICC_ProfileGray may be returned if appropriate.

Parameters: filename - the file name of the profile file.

Returns: An ICC_Profile object

Throws: IllegalArgumentException if the profile data is an invalid v2 profile. IOException if the file could not be read.

getInstance

public static ICC_Profile getInstance(InputStream in)
Returns an ICC_Profile instance from an InputStream. This method can be used for reading ICC profiles embedded in files which support this. (JPEG and SVG for instance). The stream is treated in the following way: The profile header (128 bytes) is read first, and the header is validated. If the profile header is valid, it will then attempt to read the rest of the profile from the stream. The stream is not closed after reading. An instance of the specialized classes ICC_ProfileRGB or ICC_ProfileGray may be returned if appropriate.

Parameters: in - the input stream to read the profile from.

Returns: An ICC_Profile object

Throws: IllegalArgumentException if the profile data is an invalid v2 profile. IOException if the stream could not be read.

getMajorVersion

public int getMajorVersion()
Returns the major version number

getMinorVersion

public int getMinorVersion()
Returns the minor version number. Only the least-significant byte contains data, in BCD form: the least-significant nibble is the BCD bug fix revision, the most-significant nibble is the BCD minor revision number. (E.g. For a v2.1.0 profile this will return 0x10)

getNumComponents

public int getNumComponents()
Get the number of components in the profile's device color space.

getPCSType

public int getPCSType()
Returns the color space of this profile's Profile Connection Space (OCS) In terms of the color space constants defined in ColorSpace. This may be TYPE_XYZ or TYPE_Lab

getProfileClass

public int getProfileClass()
Returns the device class of this profile, (E.g. CLASS_INPUT for a scanner profile, CLASS_OUTPUT for a printer)

readResolve

protected Object readResolve()
After deserializing we must determine if the class we want is really one of the more specialized ICC_ProfileRGB or ICC_ProfileGray classes.

setData

public void setData(int tagSignature, byte[] data)
Sets the ICC profile tag data. Note that an ICC profile can only contain one tag of each type, if a tag already exists with the given signature, it is replaced.

Parameters: tagSignature - The signature of the tag to set data - A byte array containing the tag data

write

public void write(String filename)
Writes the profile data to an ICC profile file.

Parameters: filename - The name of the file to write

Throws: IOException if the write failed.

write

public void write(OutputStream out)
Writes the profile data in ICC profile file-format to a stream. This is useful for embedding ICC profiles in file formats which support this (such as JPEG and SVG). The stream is not closed after writing.

Parameters: out - The outputstream to which the profile data should be written

Throws: IOException if the write failed.