Module java.desktop

Class ICC_Profile

java.lang.Object
java.awt.color.ICC_Profile
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
ICC_ProfileGray, ICC_ProfileRGB

public sealed class ICC_Profile extends Object implements Serializable permits ICC_ProfileGray, ICC_ProfileRGB
A representation of color profile data for device independent and device dependent color spaces based on the International Color Consortium Specification ICC.1:2001-12, File Format for Color Profiles, (see http://www.color.org).

An ICC_ColorSpace object can be constructed from an appropriate ICC_Profile. Typically, an ICC_ColorSpace would be associated with an ICC Profile which is either an input, display, or output profile (see the ICC specification). There are also device link, abstract, color space conversion, and named color profiles. These are less useful for tagging a color or image, but are useful for other purposes (in particular device link profiles can provide improved performance for converting from one device's color space to another's).

ICC Profiles represent transformations from the color space of the profile (e.g. a monitor) to a Profile Connection Space (PCS). Profiles of interest for tagging images or colors have a PCS which is one of the two specific device independent spaces (one CIEXYZ space and one CIELab space) defined in the ICC Profile Format Specification. Most profiles of interest either have invertible transformations or explicitly specify transformations going both directions.

See Also:
  • Field Details Link icon

    • CLASS_INPUT Link icon

      public static final int CLASS_INPUT
      Profile class is input.
      See Also:
    • CLASS_DISPLAY Link icon

      public static final int CLASS_DISPLAY
      Profile class is display.
      See Also:
    • CLASS_OUTPUT Link icon

      public static final int CLASS_OUTPUT
      Profile class is output.
      See Also:
    • CLASS_COLORSPACECONVERSION Link icon

      public static final int CLASS_COLORSPACECONVERSION
      Profile class is color space conversion.
      See Also:
    • CLASS_ABSTRACT Link icon

      public static final int CLASS_ABSTRACT
      Profile class is abstract.
      See Also:
    • CLASS_NAMEDCOLOR Link icon

      public static final int CLASS_NAMEDCOLOR
      Profile class is named color.
      See Also:
    • icSigXYZData Link icon

      public static final int icSigXYZData
      ICC Profile Color Space Type Signature: 'XYZ '.
      See Also:
    • icSigLabData Link icon

      public static final int icSigLabData
      ICC Profile Color Space Type Signature: 'Lab '.
      See Also:
    • icSigLuvData Link icon

      public static final int icSigLuvData
      ICC Profile Color Space Type Signature: 'Luv '.
      See Also:
    • icSigYCbCrData Link icon

      public static final int icSigYCbCrData
      ICC Profile Color Space Type Signature: 'YCbr'.
      See Also:
    • icSigYxyData Link icon

      public static final int icSigYxyData
      ICC Profile Color Space Type Signature: 'Yxy '.
      See Also:
    • icSigRgbData Link icon

      public static final int icSigRgbData
      ICC Profile Color Space Type Signature: 'RGB '.
      See Also:
    • icSigGrayData Link icon

      public static final int icSigGrayData
      ICC Profile Color Space Type Signature: 'GRAY'.
      See Also:
    • icSigHsvData Link icon

      public static final int icSigHsvData
      ICC Profile Color Space Type Signature: 'HSV'.
      See Also:
    • icSigHlsData Link icon

      public static final int icSigHlsData
      ICC Profile Color Space Type Signature: 'HLS'.
      See Also:
    • icSigCmykData Link icon

      public static final int icSigCmykData
      ICC Profile Color Space Type Signature: 'CMYK'.
      See Also:
    • icSigCmyData Link icon

      public static final int icSigCmyData
      ICC Profile Color Space Type Signature: 'CMY '.
      See Also:
    • icSigSpace2CLR Link icon

      public static final int icSigSpace2CLR
      ICC Profile Color Space Type Signature: '2CLR'.
      See Also:
    • icSigSpace3CLR Link icon

      public static final int icSigSpace3CLR
      ICC Profile Color Space Type Signature: '3CLR'.
      See Also:
    • icSigSpace4CLR Link icon

      public static final int icSigSpace4CLR
      ICC Profile Color Space Type Signature: '4CLR'.
      See Also:
    • icSigSpace5CLR Link icon

      public static final int icSigSpace5CLR
      ICC Profile Color Space Type Signature: '5CLR'.
      See Also:
    • icSigSpace6CLR Link icon

      public static final int icSigSpace6CLR
      ICC Profile Color Space Type Signature: '6CLR'.
      See Also:
    • icSigSpace7CLR Link icon

      public static final int icSigSpace7CLR
      ICC Profile Color Space Type Signature: '7CLR'.
      See Also:
    • icSigSpace8CLR Link icon

      public static final int icSigSpace8CLR
      ICC Profile Color Space Type Signature: '8CLR'.
      See Also:
    • icSigSpace9CLR Link icon

      public static final int icSigSpace9CLR
      ICC Profile Color Space Type Signature: '9CLR'.
      See Also:
    • icSigSpaceACLR Link icon

      public static final int icSigSpaceACLR
      ICC Profile Color Space Type Signature: 'ACLR'.
      See Also:
    • icSigSpaceBCLR Link icon

      public static final int icSigSpaceBCLR
      ICC Profile Color Space Type Signature: 'BCLR'.
      See Also:
    • icSigSpaceCCLR Link icon

      public static final int icSigSpaceCCLR
      ICC Profile Color Space Type Signature: 'CCLR'.
      See Also:
    • icSigSpaceDCLR Link icon

      public static final int icSigSpaceDCLR
      ICC Profile Color Space Type Signature: 'DCLR'.
      See Also:
    • icSigSpaceECLR Link icon

      public static final int icSigSpaceECLR
      ICC Profile Color Space Type Signature: 'ECLR'.
      See Also:
    • icSigSpaceFCLR Link icon

      public static final int icSigSpaceFCLR
      ICC Profile Color Space Type Signature: 'FCLR'.
      See Also:
    • icSigInputClass Link icon

      public static final int icSigInputClass
      ICC Profile Class Signature: 'scnr'.
      See Also:
    • icSigDisplayClass Link icon

      public static final int icSigDisplayClass
      ICC Profile Class Signature: 'mntr'.
      See Also:
    • icSigOutputClass Link icon

      public static final int icSigOutputClass
      ICC Profile Class Signature: 'prtr'.
      See Also:
    • icSigLinkClass Link icon

      public static final int icSigLinkClass
      ICC Profile Class Signature: 'link'.
      See Also:
    • icSigAbstractClass Link icon

      public static final int icSigAbstractClass
      ICC Profile Class Signature: 'abst'.
      See Also:
    • icSigColorSpaceClass Link icon

      public static final int icSigColorSpaceClass
      ICC Profile Class Signature: 'spac'.
      See Also:
    • icSigNamedColorClass Link icon

      public static final int icSigNamedColorClass
      ICC Profile Class Signature: 'nmcl'.
      See Also:
    • icPerceptual Link icon

      public static final int icPerceptual
      ICC Profile Rendering Intent: Perceptual.
      See Also:
    • icRelativeColorimetric Link icon

      public static final int icRelativeColorimetric
      ICC Profile Rendering Intent: RelativeColorimetric.
      See Also:
    • icMediaRelativeColorimetric Link icon

      public static final int icMediaRelativeColorimetric
      ICC Profile Rendering Intent: Media-RelativeColorimetric.
      Since:
      1.5
      See Also:
    • icSaturation Link icon

      public static final int icSaturation
      ICC Profile Rendering Intent: Saturation.
      See Also:
    • icAbsoluteColorimetric Link icon

      public static final int icAbsoluteColorimetric
      ICC Profile Rendering Intent: AbsoluteColorimetric.
      See Also:
    • icICCAbsoluteColorimetric Link icon

      public static final int icICCAbsoluteColorimetric
      ICC Profile Rendering Intent: ICC-AbsoluteColorimetric.
      Since:
      1.5
      See Also:
    • icSigHead Link icon

      public static final int icSigHead
      ICC Profile Tag Signature: 'head' - special.
      See Also:
    • icSigAToB0Tag Link icon

      public static final int icSigAToB0Tag
      ICC Profile Tag Signature: 'A2B0'.
      See Also:
    • icSigAToB1Tag Link icon

      public static final int icSigAToB1Tag
      ICC Profile Tag Signature: 'A2B1'.
      See Also:
    • icSigAToB2Tag Link icon

      public static final int icSigAToB2Tag
      ICC Profile Tag Signature: 'A2B2'.
      See Also:
    • icSigBlueColorantTag Link icon

      public static final int icSigBlueColorantTag
      ICC Profile Tag Signature: 'bXYZ'.
      See Also:
    • icSigBlueMatrixColumnTag Link icon

      public static final int icSigBlueMatrixColumnTag
      ICC Profile Tag Signature: 'bXYZ'.
      Since:
      1.5
      See Also:
    • icSigBlueTRCTag Link icon

      public static final int icSigBlueTRCTag
      ICC Profile Tag Signature: 'bTRC'.
      See Also:
    • icSigBToA0Tag Link icon

      public static final int icSigBToA0Tag
      ICC Profile Tag Signature: 'B2A0'.
      See Also:
    • icSigBToA1Tag Link icon

      public static final int icSigBToA1Tag
      ICC Profile Tag Signature: 'B2A1'.
      See Also:
    • icSigBToA2Tag Link icon

      public static final int icSigBToA2Tag
      ICC Profile Tag Signature: 'B2A2'.
      See Also:
    • icSigCalibrationDateTimeTag Link icon

      public static final int icSigCalibrationDateTimeTag
      ICC Profile Tag Signature: 'calt'.
      See Also:
    • icSigCharTargetTag Link icon

      public static final int icSigCharTargetTag
      ICC Profile Tag Signature: 'targ'.
      See Also:
    • icSigCopyrightTag Link icon

      public static final int icSigCopyrightTag
      ICC Profile Tag Signature: 'cprt'.
      See Also:
    • icSigCrdInfoTag Link icon

      public static final int icSigCrdInfoTag
      ICC Profile Tag Signature: 'crdi'.
      See Also:
    • icSigDeviceMfgDescTag Link icon

      public static final int icSigDeviceMfgDescTag
      ICC Profile Tag Signature: 'dmnd'.
      See Also:
    • icSigDeviceModelDescTag Link icon

      public static final int icSigDeviceModelDescTag
      ICC Profile Tag Signature: 'dmdd'.
      See Also:
    • icSigDeviceSettingsTag Link icon

      public static final int icSigDeviceSettingsTag
      ICC Profile Tag Signature: 'devs'.
      See Also:
    • icSigGamutTag Link icon

      public static final int icSigGamutTag
      ICC Profile Tag Signature: 'gamt'.
      See Also:
    • icSigGrayTRCTag Link icon

      public static final int icSigGrayTRCTag
      ICC Profile Tag Signature: 'kTRC'.
      See Also:
    • icSigGreenColorantTag Link icon

      public static final int icSigGreenColorantTag
      ICC Profile Tag Signature: 'gXYZ'.
      See Also:
    • icSigGreenMatrixColumnTag Link icon

      public static final int icSigGreenMatrixColumnTag
      ICC Profile Tag Signature: 'gXYZ'.
      Since:
      1.5
      See Also:
    • icSigGreenTRCTag Link icon

      public static final int icSigGreenTRCTag
      ICC Profile Tag Signature: 'gTRC'.
      See Also:
    • icSigLuminanceTag Link icon

      public static final int icSigLuminanceTag
      ICC Profile Tag Signature: 'lumi'.
      See Also:
    • icSigMeasurementTag Link icon

      public static final int icSigMeasurementTag
      ICC Profile Tag Signature: 'meas'.
      See Also:
    • icSigMediaBlackPointTag Link icon

      public static final int icSigMediaBlackPointTag
      ICC Profile Tag Signature: 'bkpt'.
      See Also:
    • icSigMediaWhitePointTag Link icon

      public static final int icSigMediaWhitePointTag
      ICC Profile Tag Signature: 'wtpt'.
      See Also:
    • icSigNamedColor2Tag Link icon

      public static final int icSigNamedColor2Tag
      ICC Profile Tag Signature: 'ncl2'.
      See Also:
    • icSigOutputResponseTag Link icon

      public static final int icSigOutputResponseTag
      ICC Profile Tag Signature: 'resp'.
      See Also:
    • icSigPreview0Tag Link icon

      public static final int icSigPreview0Tag
      ICC Profile Tag Signature: 'pre0'.
      See Also:
    • icSigPreview1Tag Link icon

      public static final int icSigPreview1Tag
      ICC Profile Tag Signature: 'pre1'.
      See Also:
    • icSigPreview2Tag Link icon

      public static final int icSigPreview2Tag
      ICC Profile Tag Signature: 'pre2'.
      See Also:
    • icSigProfileDescriptionTag Link icon

      public static final int icSigProfileDescriptionTag
      ICC Profile Tag Signature: 'desc'.
      See Also:
    • icSigProfileSequenceDescTag Link icon

      public static final int icSigProfileSequenceDescTag
      ICC Profile Tag Signature: 'pseq'.
      See Also:
    • icSigPs2CRD0Tag Link icon

      public static final int icSigPs2CRD0Tag
      ICC Profile Tag Signature: 'psd0'.
      See Also:
    • icSigPs2CRD1Tag Link icon

      public static final int icSigPs2CRD1Tag
      ICC Profile Tag Signature: 'psd1'.
      See Also:
    • icSigPs2CRD2Tag Link icon

      public static final int icSigPs2CRD2Tag
      ICC Profile Tag Signature: 'psd2'.
      See Also:
    • icSigPs2CRD3Tag Link icon

      public static final int icSigPs2CRD3Tag
      ICC Profile Tag Signature: 'psd3'.
      See Also:
    • icSigPs2CSATag Link icon

      public static final int icSigPs2CSATag
      ICC Profile Tag Signature: 'ps2s'.
      See Also:
    • icSigPs2RenderingIntentTag Link icon

      public static final int icSigPs2RenderingIntentTag
      ICC Profile Tag Signature: 'ps2i'.
      See Also:
    • icSigRedColorantTag Link icon

      public static final int icSigRedColorantTag
      ICC Profile Tag Signature: 'rXYZ'.
      See Also:
    • icSigRedMatrixColumnTag Link icon

      public static final int icSigRedMatrixColumnTag
      ICC Profile Tag Signature: 'rXYZ'.
      Since:
      1.5
      See Also:
    • icSigRedTRCTag Link icon

      public static final int icSigRedTRCTag
      ICC Profile Tag Signature: 'rTRC'.
      See Also:
    • icSigScreeningDescTag Link icon

      public static final int icSigScreeningDescTag
      ICC Profile Tag Signature: 'scrd'.
      See Also:
    • icSigScreeningTag Link icon

      public static final int icSigScreeningTag
      ICC Profile Tag Signature: 'scrn'.
      See Also:
    • icSigTechnologyTag Link icon

      public static final int icSigTechnologyTag
      ICC Profile Tag Signature: 'tech'.
      See Also:
    • icSigUcrBgTag Link icon

      public static final int icSigUcrBgTag
      ICC Profile Tag Signature: 'bfd '.
      See Also:
    • icSigViewingCondDescTag Link icon

      public static final int icSigViewingCondDescTag
      ICC Profile Tag Signature: 'vued'.
      See Also:
    • icSigViewingConditionsTag Link icon

      public static final int icSigViewingConditionsTag
      ICC Profile Tag Signature: 'view'.
      See Also:
    • icSigChromaticityTag Link icon

      public static final int icSigChromaticityTag
      ICC Profile Tag Signature: 'chrm'.
      See Also:
    • icSigChromaticAdaptationTag Link icon

      public static final int icSigChromaticAdaptationTag
      ICC Profile Tag Signature: 'chad'.
      Since:
      1.5
      See Also:
    • icSigColorantOrderTag Link icon

      public static final int icSigColorantOrderTag
      ICC Profile Tag Signature: 'clro'.
      Since:
      1.5
      See Also:
    • icSigColorantTableTag Link icon

      public static final int icSigColorantTableTag
      ICC Profile Tag Signature: 'clrt'.
      Since:
      1.5
      See Also:
    • icHdrSize Link icon

      public static final int icHdrSize
      ICC Profile Header Location: profile size in bytes.
      See Also:
    • icHdrCmmId Link icon

      public static final int icHdrCmmId
      ICC Profile Header Location: CMM for this profile.
      See Also:
    • icHdrVersion Link icon

      public static final int icHdrVersion
      ICC Profile Header Location: format version number.
      See Also:
    • icHdrDeviceClass Link icon

      public static final int icHdrDeviceClass
      ICC Profile Header Location: type of profile.
      See Also:
    • icHdrColorSpace Link icon

      public static final int icHdrColorSpace
      ICC Profile Header Location: color space of data.
      See Also:
    • icHdrPcs Link icon

      public static final int icHdrPcs
      ICC Profile Header Location: PCS - XYZ or Lab only.
      See Also:
    • icHdrDate Link icon

      public static final int icHdrDate
      ICC Profile Header Location: date profile was created.
      See Also:
    • icHdrMagic Link icon

      public static final int icHdrMagic
      ICC Profile Header Location: icMagicNumber.
      See Also:
    • icHdrPlatform Link icon

      public static final int icHdrPlatform
      ICC Profile Header Location: primary platform.
      See Also:
    • icHdrFlags Link icon

      public static final int icHdrFlags
      ICC Profile Header Location: various bit settings.
      See Also:
    • icHdrManufacturer Link icon

      public static final int icHdrManufacturer
      ICC Profile Header Location: device manufacturer.
      See Also:
    • icHdrModel Link icon

      public static final int icHdrModel
      ICC Profile Header Location: device model number.
      See Also:
    • icHdrAttributes Link icon

      public static final int icHdrAttributes
      ICC Profile Header Location: device attributes.
      See Also:
    • icHdrRenderingIntent Link icon

      public static final int icHdrRenderingIntent
      ICC Profile Header Location: rendering intent.
      See Also:
    • icHdrIlluminant Link icon

      public static final int icHdrIlluminant
      ICC Profile Header Location: profile illuminant.
      See Also:
    • icHdrCreator Link icon

      public static final int icHdrCreator
      ICC Profile Header Location: profile creator.
      See Also:
    • icHdrProfileID Link icon

      public static final int icHdrProfileID
      ICC Profile Header Location: profile's ID.
      Since:
      1.5
      See Also:
    • icTagType Link icon

      public static final int icTagType
      ICC Profile Constant: tag type signature.
      See Also:
    • icTagReserved Link icon

      public static final int icTagReserved
      ICC Profile Constant: reserved.
      See Also:
    • icCurveCount Link icon

      public static final int icCurveCount
      ICC Profile Constant: curveType count.
      See Also:
    • icCurveData Link icon

      public static final int icCurveData
      ICC Profile Constant: curveType data.
      See Also:
    • icXYZNumberX Link icon

      public static final int icXYZNumberX
      ICC Profile Constant: XYZNumber X.
      See Also:
  • Method Details Link icon

    • getInstance Link icon

      public static ICC_Profile getInstance(byte[] data)
      Constructs an ICC_Profile object corresponding to the data in a byte array.
      Parameters:
      data - the specified ICC Profile data
      Returns:
      an ICC_Profile object corresponding to the data in the specified data array
      Throws:
      IllegalArgumentException - If the byte array does not contain valid ICC Profile data
    • getInstance Link icon

      public 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). Throws an IllegalArgumentException if cspace is not one of the defined color spaces.
      Parameters:
      cspace - the type of color space to create a profile for. The specified type is one of the color space constants defined in the ColorSpace class.
      Returns:
      an ICC_Profile object corresponding to the specified ColorSpace type
      Throws:
      IllegalArgumentException - If cspace is not one of the predefined color space types
    • getInstance Link icon

      public static ICC_Profile getInstance(String fileName) throws IOException
      Constructs an ICC_Profile corresponding to the data in a file. fileName may be an absolute or a relative file specification. Relative file names are looked for in several places: first, relative to any directories specified by the java.iccprofile.path property; second, relative to any directories specified by the java.class.path property; finally, in a directory used to store profiles always available, such as the profile for sRGB. Built-in profiles use .pf as the file name extension for profiles, e.g. sRGB.pf.
      Parameters:
      fileName - the file that contains the data for the profile
      Returns:
      an ICC_Profile object corresponding to the data in the specified file
      Throws:
      IOException - If the specified file cannot be opened or an I/O error occurs while reading the file
      IllegalArgumentException - If the file does not contain valid ICC Profile data
      SecurityException - If a security manager is installed and it does not permit read access to the given file
      NullPointerException - if fileName is null
    • getInstance Link icon

      public static ICC_Profile getInstance(InputStream s) throws IOException
      Constructs an ICC_Profile corresponding to the data in an InputStream.
      Parameters:
      s - the input stream from which to read the profile data
      Returns:
      an ICC_Profile object corresponding to the data in the specified InputStream
      Throws:
      IOException - If an I/O error occurs while reading the stream
      IllegalArgumentException - If the stream does not contain valid ICC Profile data
      NullPointerException - if s is null
    • getMajorVersion Link icon

      public int getMajorVersion()
      Returns profile major version.
      Returns:
      the major version of the profile
    • getMinorVersion Link icon

      public int getMinorVersion()
      Returns profile minor version.
      Returns:
      the minor version of the profile
    • getProfileClass Link icon

      public int getProfileClass()
      Returns the profile class.
      Returns:
      one of the predefined profile class constants
    • getColorSpaceType Link icon

      public int getColorSpaceType()
      Returns the color space type. Returns one of the color space type constants defined by the ColorSpace class. This is the "input" color space of the profile. The type defines the number of components of the color space and the interpretation, e.g. TYPE_RGB identifies a color space with three components - red, green, and blue. It does not define the particular color characteristics of the space, e.g. the chromaticities of the primaries.
      Returns:
      one of the color space type constants defined in the ColorSpace class
    • getPCSType Link icon

      public int getPCSType()
      Returns the color space type of the Profile Connection Space (PCS). Returns one of the color space type constants defined by the ColorSpace class. This is the "output" color space of the profile. For an input, display, or output profile useful for tagging colors or images, this will be either TYPE_XYZ or TYPE_Lab and should be interpreted as the corresponding specific color space defined in the ICC specification. For a device link profile, this could be any of the color space type constants.
      Returns:
      one of the color space type constants defined in the ColorSpace class
    • write Link icon

      public void write(String fileName) throws IOException
      Write this ICC_Profile to a file.
      Parameters:
      fileName - the file to write the profile data to
      Throws:
      IOException - If the file cannot be opened for writing or an I/O error occurs while writing to the file
      NullPointerException - if fileName is null
    • write Link icon

      public void write(OutputStream s) throws IOException
      Write this ICC_Profile to an OutputStream.
      Parameters:
      s - the stream to write the profile data to
      Throws:
      IOException - If an I/O error occurs while writing to the stream
      NullPointerException - if s is null
    • getData Link icon

      public byte[] getData()
      Returns a byte array corresponding to the data of this ICC_Profile.
      Returns:
      a byte array that contains the profile data
      See Also:
    • getData Link icon

      public byte[] getData(int tagSignature)
      Returns a particular tagged data element from the profile as a byte array. Elements are identified by signatures as defined in the ICC specification. The signature icSigHead can be used to get the header. This method is useful for advanced applications which need to access profile data directly.
      Parameters:
      tagSignature - the ICC tag signature for the data element you want to get
      Returns:
      a byte array that contains the tagged data element. Returns null if the specified tag doesn't exist.
      See Also:
    • setData Link icon

      public void setData(int tagSignature, byte[] tagData)
      Sets a particular tagged data element in the profile from a byte array. The array should contain data in a format, corresponded to the tagSignature as defined in the ICC specification, section 10. This method is useful for advanced applications which need to access profile data directly.
      Parameters:
      tagSignature - the ICC tag signature for the data element you want to set
      tagData - the data to set for the specified tag signature
      Throws:
      IllegalArgumentException - if tagSignature is not a signature as defined in the ICC specification.
      IllegalArgumentException - if a content of the tagData array can not be interpreted as valid tag data, corresponding to the tagSignature
      See Also:
    • getNumComponents Link icon

      public int getNumComponents()
      Returns the number of color components in the "input" color space of this profile. For example if the color space type of this profile is TYPE_RGB, then this method will return 3.
      Returns:
      the number of color components in the profile's input color space
      Throws:
      ProfileDataException - if color space is in the profile is invalid
    • readResolve Link icon

      protected Object readResolve() throws ObjectStreamException
      Resolves instances being deserialized into instances registered with CMM.
      Returns:
      ICC_Profile object for profile registered with CMM
      Throws:
      ObjectStreamException - never thrown, but mandated by the serialization spec
      Since:
      1.3