public void setICCProfileData(byte[] ICCProfileData) {
        this.ICCProfileData = (byte[])(ICCProfileData.clone());
        ICCProfileDataSet = true;
	ICC_Profile profile = ICC_Profile.getInstance(this.ICCProfileData);
	if (!(profile instanceof ICC_ProfileRGB || 
	    profile instanceof ICC_ProfileGray))
	    return;

	//Set gamma	
	try {
	    if (profile instanceof ICC_ProfileRGB)
		setGamma(((ICC_ProfileRGB)profile).getGamma(ICC_ProfileRGB.REDCOMPONENT));
	    else if (profile instanceof ICC_ProfileGray)
		setGamma(((ICC_ProfileGray)profile).getGamma());
	} catch(Exception e) {
	    //Gamma is not defined.  TRC is defined.  So ignore.
	}

	if (profile instanceof ICC_ProfileGray)
	    return;

	// Set cHRM
	float[] chrom = new float[8];
	float[] whitePoint = ((ICC_ProfileRGB)profile).getMediaWhitePoint();
	if (whitePoint == null)
	    return;

	float sum = whitePoint[0] + whitePoint[1] + whitePoint[2];
	chrom[0] = whitePoint[0] / sum;
	chrom[1] = whitePoint[1] / sum;

	float[][] temp = ((ICC_ProfileRGB)profile).getMatrix();
	if (temp == null)
	    return;

	for (int i = 0; i < 3; i++) {
	    sum = temp[0][i] + temp[1][i] + temp[2][i];
	    chrom[2 + (i << 1 )] = temp[0][i] / sum;
	    chrom[3 + (i << 1)] = temp[1][i] / sum;
	}

	setChromaticity(chrom);
    }