ICC_ProfileGray (Java SE 26 & JDK 26)
Description: declaration: module: java.desktop, package: java.awt.color, class: ICC_ProfileGray
Keywords: java.awt.color.ICC_ProfileGray class

# Class ICC_ProfileGray

java.lang.Object
java.awt.color.ICC_Profile
java.awt.color.ICC_ProfileGray

All Implemented Interfaces:
  `Serializable`

public final class ICC_ProfileGray extends ICC_Profile
The `ICC_ProfileGray` class is a subclass of the `ICC_Profile` class that represents profiles which meet the following criteria: the color space type of the profile is `TYPE_GRAY` and the profile includes the `grayTRCTag` and `mediaWhitePointTag` tags. The `getInstance` methods in the `ICC_Profile` class will return an `ICC_ProfileGray` object when the above conditions are met. Examples of this kind of profile are monochrome input profiles, monochrome display profiles, and monochrome output profiles.

The advantage of this class is that it provides a lookup table that Java or native methods can use directly to optimize color conversion in some cases.

To transform from a GRAY device profile color space to the CIEXYZ Profile Connection Space, the device gray component is transformed by a lookup through the tone reproduction curve (TRC). The result is treated as the achromatic component of the PCS.

                    PCSY = grayTRC[deviceGray]

The inverse transform is done by converting the PCS Y components to device Gray via the inverse of the grayTRC.

See Also:
  - Serialized Form

- ## Field Summary

  ### Fields declared in class ICC_Profile

  `CLASS_ABSTRACT, CLASS_COLORSPACECONVERSION, CLASS_DEVICELINK, CLASS_DISPLAY, CLASS_INPUT, CLASS_NAMEDCOLOR, CLASS_OUTPUT, icAbsoluteColorimetric, icCurveCount, icCurveData, icHdrAttributes, icHdrCmmId, icHdrColorSpace, icHdrCreator, icHdrDate, icHdrDeviceClass, icHdrFlags, icHdrIlluminant, icHdrMagic, icHdrManufacturer, icHdrModel, icHdrPcs, icHdrPlatform, icHdrProfileID, icHdrRenderingIntent, icHdrSize, icHdrVersion, icICCAbsoluteColorimetric, icMediaRelativeColorimetric, icPerceptual, icRelativeColorimetric, icSaturation, icSigAbstractClass, icSigAToB0Tag, icSigAToB1Tag, icSigAToB2Tag, icSigBlueColorantTag, icSigBlueMatrixColumnTag, icSigBlueTRCTag, icSigBToA0Tag, icSigBToA1Tag, icSigBToA2Tag, icSigCalibrationDateTimeTag, icSigCharTargetTag, icSigChromaticAdaptationTag, icSigChromaticityTag, icSigCmyData, icSigCmykData, icSigColorantOrderTag, icSigColorantTableTag, icSigColorSpaceClass, icSigCopyrightTag, icSigCrdInfoTag, icSigDeviceMfgDescTag, icSigDeviceModelDescTag, icSigDeviceSettingsTag, icSigDisplayClass, icSigGamutTag, icSigGrayData, icSigGrayTRCTag, icSigGreenColorantTag, icSigGreenMatrixColumnTag, icSigGreenTRCTag, icSigHead, icSigHlsData, icSigHsvData, icSigInputClass, icSigLabData, icSigLinkClass, icSigLuminanceTag, icSigLuvData, icSigMeasurementTag, icSigMediaBlackPointTag, icSigMediaWhitePointTag, icSigNamedColor2Tag, icSigNamedColorClass, icSigOutputClass, icSigOutputResponseTag, icSigPreview0Tag, icSigPreview1Tag, icSigPreview2Tag, icSigProfileDescriptionTag, icSigProfileSequenceDescTag, icSigPs2CRD0Tag, icSigPs2CRD1Tag, icSigPs2CRD2Tag, icSigPs2CRD3Tag, icSigPs2CSATag, icSigPs2RenderingIntentTag, icSigRedColorantTag, icSigRedMatrixColumnTag, icSigRedTRCTag, icSigRgbData, icSigScreeningDescTag, icSigScreeningTag, icSigSpace2CLR, icSigSpace3CLR, icSigSpace4CLR, icSigSpace5CLR, icSigSpace6CLR, icSigSpace7CLR, icSigSpace8CLR, icSigSpace9CLR, icSigSpaceACLR, icSigSpaceBCLR, icSigSpaceCCLR, icSigSpaceDCLR, icSigSpaceECLR, icSigSpaceFCLR, icSigTechnologyTag, icSigUcrBgTag, icSigViewingCondDescTag, icSigViewingConditionsTag, icSigXYZData, icSigYCbCrData, icSigYxyData, icTagReserved, icTagType, icXYZNumberX`
  Modifier and Type
  Field
  Description
  `static final int`
  `CLASS_ABSTRACT`
  Profile class is abstract.
  `static final int`
  `CLASS_COLORSPACECONVERSION`
  Profile class is color space conversion.
  `static final int`
  `CLASS_DEVICELINK`
  Profile class is device link.
  `static final int`
  `CLASS_DISPLAY`
  Profile class is display.
  `static final int`
  `CLASS_INPUT`
  Profile class is input.
  `static final int`
  `CLASS_NAMEDCOLOR`
  Profile class is named color.
  `static final int`
  `CLASS_OUTPUT`
  Profile class is output.
  `static final int`
  `icAbsoluteColorimetric`
  ICC Profile Rendering Intent: AbsoluteColorimetric.
  `static final int`
  `icCurveCount`
  ICC Profile Constant: curveType count.
  `static final int`
  `icCurveData`
  ICC Profile Constant: curveType data.
  `static final int`
  `icHdrAttributes`
  ICC Profile Header Location: device attributes.
  `static final int`
  `icHdrCmmId`
  ICC Profile Header Location: CMM for this profile.
  `static final int`
  `icHdrColorSpace`
  ICC Profile Header Location: color space of data.
  `static final int`
  `icHdrCreator`
  ICC Profile Header Location: profile creator.
  `static final int`
  `icHdrDate`
  ICC Profile Header Location: date profile was created.
  `static final int`
  `icHdrDeviceClass`
  ICC Profile Header Location: type of profile.
  `static final int`
  `icHdrFlags`
  ICC Profile Header Location: various bit settings.
  `static final int`
  `icHdrIlluminant`
  ICC Profile Header Location: profile illuminant.
  `static final int`
  `icHdrMagic`
  ICC Profile Header Location: icMagicNumber.
  `static final int`
  `icHdrManufacturer`
  ICC Profile Header Location: device manufacturer.
  `static final int`
  `icHdrModel`
  ICC Profile Header Location: device model number.
  `static final int`
  `icHdrPcs`
  ICC Profile Header Location: PCS - XYZ or Lab only.
  `static final int`
  `icHdrPlatform`
  ICC Profile Header Location: primary platform.
  `static final int`
  `icHdrProfileID`
  ICC Profile Header Location: profile's ID.
  `static final int`
  `icHdrRenderingIntent`
  ICC Profile Header Location: rendering intent.
  `static final int`
  `icHdrSize`
  ICC Profile Header Location: profile size in bytes.
  `static final int`
  `icHdrVersion`
  ICC Profile Header Location: format version number.
  `static final int`
  `icICCAbsoluteColorimetric`
  ICC Profile Rendering Intent: ICC-AbsoluteColorimetric.
  `static final int`
  `icMediaRelativeColorimetric`
  ICC Profile Rendering Intent: Media-RelativeColorimetric.
  `static final int`
  `icPerceptual`
  ICC Profile Rendering Intent: Perceptual.
  `static final int`
  `icRelativeColorimetric`
  ICC Profile Rendering Intent: RelativeColorimetric.
  `static final int`
  `icSaturation`
  ICC Profile Rendering Intent: Saturation.
  `static final int`
  `icSigAbstractClass`
  ICC Profile Class Signature: 'abst'.
  `static final int`
  `icSigAToB0Tag`
  ICC Profile Tag Signature: 'A2B0'.
  `static final int`
  `icSigAToB1Tag`
  ICC Profile Tag Signature: 'A2B1'.
  `static final int`
  `icSigAToB2Tag`
  ICC Profile Tag Signature: 'A2B2'.
  `static final int`
  `icSigBlueColorantTag`
  ICC Profile Tag Signature: 'bXYZ'.
  `static final int`
  `icSigBlueMatrixColumnTag`
  ICC Profile Tag Signature: 'bXYZ'.
  `static final int`
  `icSigBlueTRCTag`
  ICC Profile Tag Signature: 'bTRC'.
  `static final int`
  `icSigBToA0Tag`
  ICC Profile Tag Signature: 'B2A0'.
  `static final int`
  `icSigBToA1Tag`
  ICC Profile Tag Signature: 'B2A1'.
  `static final int`
  `icSigBToA2Tag`
  ICC Profile Tag Signature: 'B2A2'.
  `static final int`
  `icSigCalibrationDateTimeTag`
  ICC Profile Tag Signature: 'calt'.
  `static final int`
  `icSigCharTargetTag`
  ICC Profile Tag Signature: 'targ'.
  `static final int`
  `icSigChromaticAdaptationTag`
  ICC Profile Tag Signature: 'chad'.
  `static final int`
  `icSigChromaticityTag`
  ICC Profile Tag Signature: 'chrm'.
  `static final int`
  `icSigCmyData`
  ICC Profile Color Space Type Signature: 'CMY '.
  `static final int`
  `icSigCmykData`
  ICC Profile Color Space Type Signature: 'CMYK'.
  `static final int`
  `icSigColorantOrderTag`
  ICC Profile Tag Signature: 'clro'.
  `static final int`
  `icSigColorantTableTag`
  ICC Profile Tag Signature: 'clrt'.
  `static final int`
  `icSigColorSpaceClass`
  ICC Profile Class Signature: 'spac'.
  `static final int`
  `icSigCopyrightTag`
  ICC Profile Tag Signature: 'cprt'.
  `static final int`
  `icSigCrdInfoTag`
  ICC Profile Tag Signature: 'crdi'.
  `static final int`
  `icSigDeviceMfgDescTag`
  ICC Profile Tag Signature: 'dmnd'.
  `static final int`
  `icSigDeviceModelDescTag`
  ICC Profile Tag Signature: 'dmdd'.
  `static final int`
  `icSigDeviceSettingsTag`
  ICC Profile Tag Signature: 'devs'.
  `static final int`
  `icSigDisplayClass`
  ICC Profile Class Signature: 'mntr'.
  `static final int`
  `icSigGamutTag`
  ICC Profile Tag Signature: 'gamt'.
  `static final int`
  `icSigGrayData`
  ICC Profile Color Space Type Signature: 'GRAY'.
  `static final int`
  `icSigGrayTRCTag`
  ICC Profile Tag Signature: 'kTRC'.
  `static final int`
  `icSigGreenColorantTag`
  ICC Profile Tag Signature: 'gXYZ'.
  `static final int`
  `icSigGreenMatrixColumnTag`
  ICC Profile Tag Signature: 'gXYZ'.
  `static final int`
  `icSigGreenTRCTag`
  ICC Profile Tag Signature: 'gTRC'.
  `static final int`
  `icSigHead`
  ICC Profile Tag Signature: 'head' - special.
  `static final int`
  `icSigHlsData`
  ICC Profile Color Space Type Signature: 'HLS'.
  `static final int`
  `icSigHsvData`
  ICC Profile Color Space Type Signature: 'HSV'.
  `static final int`
  `icSigInputClass`
  ICC Profile Class Signature: 'scnr'.
  `static final int`
  `icSigLabData`
  ICC Profile Color Space Type Signature: 'Lab '.
  `static final int`
  `icSigLinkClass`
  ICC Profile Class Signature: 'link'.
  `static final int`
  `icSigLuminanceTag`
  ICC Profile Tag Signature: 'lumi'.
  `static final int`
  `icSigLuvData`
  ICC Profile Color Space Type Signature: 'Luv '.
  `static final int`
  `icSigMeasurementTag`
  ICC Profile Tag Signature: 'meas'.
  `static final int`
  `icSigMediaBlackPointTag`
  ICC Profile Tag Signature: 'bkpt'.
  `static final int`
  `icSigMediaWhitePointTag`
  ICC Profile Tag Signature: 'wtpt'.
  `static final int`
  `icSigNamedColor2Tag`
  ICC Profile Tag Signature: 'ncl2'.
  `static final int`
  `icSigNamedColorClass`
  ICC Profile Class Signature: 'nmcl'.
  `static final int`
  `icSigOutputClass`
  ICC Profile Class Signature: 'prtr'.
  `static final int`
  `icSigOutputResponseTag`
  ICC Profile Tag Signature: 'resp'.
  `static final int`
  `icSigPreview0Tag`
  ICC Profile Tag Signature: 'pre0'.
  `static final int`
  `icSigPreview1Tag`
  ICC Profile Tag Signature: 'pre1'.
  `static final int`
  `icSigPreview2Tag`
  ICC Profile Tag Signature: 'pre2'.
  `static final int`
  `icSigProfileDescriptionTag`
  ICC Profile Tag Signature: 'desc'.
  `static final int`
  `icSigProfileSequenceDescTag`
  ICC Profile Tag Signature: 'pseq'.
  `static final int`
  `icSigPs2CRD0Tag`
  ICC Profile Tag Signature: 'psd0'.
  `static final int`
  `icSigPs2CRD1Tag`
  ICC Profile Tag Signature: 'psd1'.
  `static final int`
  `icSigPs2CRD2Tag`
  ICC Profile Tag Signature: 'psd2'.
  `static final int`
  `icSigPs2CRD3Tag`
  ICC Profile Tag Signature: 'psd3'.
  `static final int`
  `icSigPs2CSATag`
  ICC Profile Tag Signature: 'ps2s'.
  `static final int`
  `icSigPs2RenderingIntentTag`
  ICC Profile Tag Signature: 'ps2i'.
  `static final int`
  `icSigRedColorantTag`
  ICC Profile Tag Signature: 'rXYZ'.
  `static final int`
  `icSigRedMatrixColumnTag`
  ICC Profile Tag Signature: 'rXYZ'.
  `static final int`
  `icSigRedTRCTag`
  ICC Profile Tag Signature: 'rTRC'.
  `static final int`
  `icSigRgbData`
  ICC Profile Color Space Type Signature: 'RGB '.
  `static final int`
  `icSigScreeningDescTag`
  ICC Profile Tag Signature: 'scrd'.
  `static final int`
  `icSigScreeningTag`
  ICC Profile Tag Signature: 'scrn'.
  `static final int`
  `icSigSpace2CLR`
  ICC Profile Color Space Type Signature: '2CLR'.
  `static final int`
  `icSigSpace3CLR`
  ICC Profile Color Space Type Signature: '3CLR'.
  `static final int`
  `icSigSpace4CLR`
  ICC Profile Color Space Type Signature: '4CLR'.
  `static final int`
  `icSigSpace5CLR`
  ICC Profile Color Space Type Signature: '5CLR'.
  `static final int`
  `icSigSpace6CLR`
  ICC Profile Color Space Type Signature: '6CLR'.
  `static final int`
  `icSigSpace7CLR`
  ICC Profile Color Space Type Signature: '7CLR'.
  `static final int`
  `icSigSpace8CLR`
  ICC Profile Color Space Type Signature: '8CLR'.
  `static final int`
  `icSigSpace9CLR`
  ICC Profile Color Space Type Signature: '9CLR'.
  `static final int`
  `icSigSpaceACLR`
  ICC Profile Color Space Type Signature: 'ACLR'.
  `static final int`
  `icSigSpaceBCLR`
  ICC Profile Color Space Type Signature: 'BCLR'.
  `static final int`
  `icSigSpaceCCLR`
  ICC Profile Color Space Type Signature: 'CCLR'.
  `static final int`
  `icSigSpaceDCLR`
  ICC Profile Color Space Type Signature: 'DCLR'.
  `static final int`
  `icSigSpaceECLR`
  ICC Profile Color Space Type Signature: 'ECLR'.
  `static final int`
  `icSigSpaceFCLR`
  ICC Profile Color Space Type Signature: 'FCLR'.
  `static final int`
  `icSigTechnologyTag`
  ICC Profile Tag Signature: 'tech'.
  `static final int`
  `icSigUcrBgTag`
  ICC Profile Tag Signature: 'bfd '.
  `static final int`
  `icSigViewingCondDescTag`
  ICC Profile Tag Signature: 'vued'.
  `static final int`
  `icSigViewingConditionsTag`
  ICC Profile Tag Signature: 'view'.
  `static final int`
  `icSigXYZData`
  ICC Profile Color Space Type Signature: 'XYZ '.
  `static final int`
  `icSigYCbCrData`
  ICC Profile Color Space Type Signature: 'YCbr'.
  `static final int`
  `icSigYxyData`
  ICC Profile Color Space Type Signature: 'Yxy '.
  `static final int`
  `icTagReserved`
  ICC Profile Constant: reserved.
  `static final int`
  `icTagType`
  ICC Profile Constant: tag type signature.
  `static final int`
  `icXYZNumberX`
  ICC Profile Constant: XYZNumber X.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `float`
  `getGamma()`
  Returns a gamma value representing the tone reproduction curve (TRC).
  `float[]`
  `getMediaWhitePoint()`
  Returns a float array of length 3 containing the X, Y, and Z components of the mediaWhitePointTag in the ICC profile.
  `short[]`
  `getTRC()`
  Returns the TRC as an array of shorts.

  ### Methods declared in class ICC_Profile

  `getColorSpaceType, getData, getData, getInstance, getInstance, getInstance, getInstance, getMajorVersion, getMinorVersion, getNumComponents, getPCSType, getProfileClass, readResolve, setData, write, write`
  Modifier and Type
  Method
  Description
  `int`
  `getColorSpaceType()`
  Returns the color space type.
  `byte[]`
  `getData()`
  Returns a byte array corresponding to the data of this `ICC_Profile`.
  `byte[]`
  `getData(int tagSignature)`
  Returns a particular tagged data element from the profile as a byte array.
  `static ICC_Profile`
  `getInstance(byte[] data)`
  Constructs an `ICC_Profile` object corresponding to the data in a byte array.
  `static ICC_Profile`
  `getInstance(int cspace)`
  Constructs an `ICC_Profile` corresponding to one of the specific color spaces defined by the `ColorSpace` class (for example `CS_sRGB`).
  `static ICC_Profile`
  `getInstance(InputStream s)`
  Constructs an `ICC_Profile` corresponding to the data in an `InputStream`.
  `static ICC_Profile`
  `getInstance(String fileName)`
  Constructs an `ICC_Profile` corresponding to the data in a file.
  `int`
  `getMajorVersion()`
  Returns profile major version.
  `int`
  `getMinorVersion()`
  Returns profile minor version.
  `int`
  `getNumComponents()`
  Returns the number of color components in the "input" color space of this profile.
  `int`
  `getPCSType()`
  Returns the color space type of the Profile Connection Space (PCS).
  `int`
  `getProfileClass()`
  Returns the profile class.
  `protected Object`
  `readResolve()`
  Resolves instances being deserialized into instances registered with CMM.
  `void`
  `setData(int tagSignature, byte[] tagData)`
  Sets a particular tagged data element in the profile from a byte array.
  `void`
  `write(OutputStream s)`
  Write this `ICC_Profile` to an `OutputStream`.
  `void`
  `write(String fileName)`
  Write this `ICC_Profile` to a file.

  ### Methods declared in class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
  Modifier and Type
  Method
  Description
  `protected Object`
  `clone()`
  Creates and returns a copy of this object.
  `boolean`
  `equals(Object obj)`
  Indicates whether some other object is "equal to" this one.
  `protected void`
  `finalize()`
  Deprecated, for removal: This API element is subject to removal in a future version.
  Finalization is deprecated and subject to removal in a future release.
  `final Class<?>`
  `getClass()`
  Returns the runtime class of this `Object`.
  `int`
  `hashCode()`
  Returns a hash code value for this object.
  `final void`
  `notify()`
  Wakes up a single thread that is waiting on this object's monitor.
  `final void`
  `notifyAll()`
  Wakes up all threads that are waiting on this object's monitor.
  `String`
  `toString()`
  Returns a string representation of the object.
  `final void`
  `wait()`
  Causes the current thread to wait until it is awakened, typically by being notified or interrupted.
  `final void`
  `wait(long timeoutMillis)`
  Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
  `final void`
  `wait(long timeoutMillis, int nanos)`
  Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

- ## Method Details

  - ### getMediaWhitePoint

    public float[] getMediaWhitePoint()
    Returns a float array of length 3 containing the X, Y, and Z components of the mediaWhitePointTag in the ICC profile.
    Returns:
      an array containing the components of the mediaWhitePointTag in the ICC profile

  - ### getGamma

    public float getGamma()
    Returns a gamma value representing the tone reproduction curve (TRC). If the profile represents the TRC as a table rather than a single gamma value, then an exception is thrown. In this case the actual table can be obtained via `getTRC()`. When using a gamma value, the PCS Y component is computed as follows:

                                  gamma
                 PCSY = deviceGray

    Returns:
      the gamma value as a float
    Throws:
      `ProfileDataException` - if the profile does not specify the TRC as a single gamma value

  - ### getTRC

    public short[] getTRC()
    Returns the TRC as an array of shorts. If the profile has specified the TRC as linear (gamma = 1.0) or as a simple gamma value, this method throws an exception, and the `getGamma()` method should be used to get the gamma value. Otherwise the short array returned here represents a lookup table where the input Gray value is conceptually in the range [0.0, 1.0]. Value 0.0 maps to array index 0 and value 1.0 maps to array index `length-1`. Interpolation may be used to generate output values for input values which do not map exactly to an index in the array. Output values also map linearly to the range [0.0, 1.0]. Value 0.0 is represented by an array value of 0x0000 and value 1.0 by 0xFFFF, i.e. the values are really unsigned short values, although they are returned in a short array.
    Returns:
      a short array representing the TRC
    Throws:
      `ProfileDataException` - if the profile does not specify the TRC as a table