protected static ICC_Profile getIccProfile(final ByteSource byteSource) throws ImagingException, IOException {
        final byte[] bytes = getIccProfileBytes(byteSource);
        if (bytes == null) {
            return null;
        }

        final IccProfileParser parser = new IccProfileParser();
        final IccProfileInfo info = parser.getIccProfileInfo(bytes);
        if (info == null) {
            return null;
        }
        if (info.isSrgb()) {
            return null;
        }

        return ICC_Profile.getInstance(bytes);
    }
Extracts an ICC Profile (if present) from JPEG, PNG, PSD (Photoshop) and TIFF images.

@param bytes Byte array containing an image file.
@return An instance of ICC_Profile or null if the image contains no ICC profile.
@throws ImagingException if it fails to parse the image
@throws IOException      if it fails to read the image data
src/main/java/org/apache/commons/imaging/Imaging.java