Examples of ICC_Profile


Examples of java.awt.color.ICC_Profile

                profiles.addAll(getColorProfiles(file));
            }
            else if (file.isFile()) {
                String path = file.getAbsolutePath();
                try {
                    ICC_Profile profile = ICC_Profile.getInstance(path);
                    String name = ColorProfileInfo.getNameOf(profile);
                    ColorProfileInfo info = new ColorProfileInfo(name, path);
                    profiles.add(info);
                }
                catch (IOException e) {
View Full Code Here

Examples of java.awt.color.ICC_Profile

     * <p> The 'iCCP' chunk will encode this information.
     */
    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 
View Full Code Here

Examples of java.awt.color.ICC_Profile

    private static final String NCP_EXAMPLE_FILE = "ncp-example.icc";

    public void testParser() throws Exception {
        InputStream in = getClass().getResourceAsStream(NCP_EXAMPLE_FILE);
        assertNotNull(NCP_EXAMPLE_FILE + " is missing!", in);
        ICC_Profile iccProfile;
        try {
            iccProfile = ICC_Profile.getInstance(in);
        } finally {
            IOUtils.closeQuietly(in);
        }
View Full Code Here

Examples of java.awt.color.ICC_Profile

    private void addsRGBColorSpace() throws IOException {
        if (this.sRGBColorSpace != null) {
            return;
        }
        ICC_Profile profile;
        PDFICCStream sRGBProfile = pdfDoc.getFactory().makePDFICCStream();
        InputStream in = PDFDocument.class.getResourceAsStream("sRGB Color Space Profile.icm");
        if (in != null) {
            try {
                profile = ICC_Profile.getInstance(in);
View Full Code Here

Examples of java.awt.color.ICC_Profile

   
    private void addDefaultOutputProfile() throws IOException {
        if (this.outputProfile != null) {
            return;
        }
        ICC_Profile profile;
        InputStream in = null;
        if (this.outputProfileURI != null) {
            this.outputProfile = pdfDoc.getFactory().makePDFICCStream();
            Source src = userAgent.resolveURI(this.outputProfileURI);
            if (src == null) {
View Full Code Here

Examples of java.awt.color.ICC_Profile

                } catch (IOException ioe) {
                    throw new IOException("Error while aligning ICC stream: " + ioe.getMessage());
                }
            }

            ICC_Profile iccProfile = null;
            try {
                iccProfile = ColorProfileUtil.getICC_Profile(iccStream.toByteArray());
                if (log.isDebugEnabled()) {
                    log.debug("JPEG has an ICC profile: " + iccProfile.toString());
                }
            } catch (IllegalArgumentException iae) {
                log.warn("An ICC profile is present in the JPEG file but it is invalid ("
                        + iae.getMessage() + "). The color profile will be ignored. ("
                        + info.getOriginalURI() + ")");
                return null;
            }
            if (iccProfile.getNumComponents() != colorSpace.getNumComponents()) {
                log.warn("The number of components of the ICC profile ("
                        + iccProfile.getNumComponents()
                        + ") doesn't match the image ("
                        + colorSpace.getNumComponents()
                        + "). Ignoring the ICC color profile.");
                return null;
            } else {
View Full Code Here

Examples of java.awt.color.ICC_Profile

        runReaders(profiles, sessionContext, "iccTest.png", "image/png",
                ImageFlavor.RAW_PNG);
        runReaders(profiles, sessionContext, "iccTest.jpg", "image/jpeg",
                ImageFlavor.RAW_JPEG);

        ICC_Profile first = (ICC_Profile) profiles.get(0);
        byte[] firstData = first.getData();
        for (int i = 1; i < profiles.size(); i++) {
            ICC_Profile icc = (ICC_Profile) profiles.get(i);
            byte[] data = icc.getData();
            assertEquals("Embedded ICC Profiles are not the same size!",
                    firstData.length, data.length);
            for (int j = 0; j < firstData.length; j++) {
                assertEquals("Embedded ICC Profiles differ at index " + j,
                        firstData[j], data[j]);
View Full Code Here

Examples of java.awt.color.ICC_Profile

                        // temporary measure until ImageLoaderRawPNG and ImageLoader PNG handle ICC profiles
                        continue;
                    }
                    final ImageInfo im = new ImageInfo(uri, mime);
                    final Image img = il.loadImage(im, isc);
                    final ICC_Profile icc = img.getICCProfile();
                    // Assume the profile can only be correct if the image could
                    // actually be interpreted.
                    if (img.getColorSpace() != null) {
                        profiles.add(icc);
                    }
                } catch (IllegalArgumentException e) {
                    // Ignore. This imageLoader does not support RAW
                }
                try {
                    final ImageLoader il = ilf.newImageLoader(ImageFlavor.BUFFERED_IMAGE);
                    final ImageInfo im = new ImageInfo(uri, mime);
                    final Image img = il.loadImage(im, isc);
                    final ICC_Profile icc = img.getICCProfile();
                    profiles.add(icc);
                } catch (IllegalArgumentException e) {
                    // Ignore. This imageLoader does not support Buffered.
                }
            }
View Full Code Here

Examples of java.awt.color.ICC_Profile

            //transparent color will be extracted later from the image
        } else {
            if (providerIgnoresICC && cm instanceof ComponentColorModel) {
                // Apply ICC Profile to Image by creating a new image with a new
                // color model.
                ICC_Profile iccProf = tryToExctractICCProfile(iiometa);
                if (iccProf != null) {
                    ColorModel cm2 = new ComponentColorModel(
                            new ICC_ColorSpace(iccProf), cm.hasAlpha(), cm
                                    .isAlphaPremultiplied(), cm
                                    .getTransparency(), cm.getTransferType());
View Full Code Here

Examples of java.awt.color.ICC_Profile

     * @param iiometa
     *            The ImageIO Metadata
     * @return an ICC Profile or null.
     */
    private ICC_Profile tryToExctractICCProfile(IIOMetadata iiometa) {
        ICC_Profile iccProf = null;
        String[] supportedFormats = iiometa.getMetadataFormatNames();
        for (int i = 0; i < supportedFormats.length; i++) {
            String format = supportedFormats[i];
            Element root = (Element) iiometa.getAsTree(format);
            if (PNG_METADATA_NODE.equals(format)) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.