Class CMYKJPEGImageReader


  • public class CMYKJPEGImageReader
    extends ImageReader
    Reads a JPEG image with colors in the CMYK color space.
    Version:
    $Id: CMYKJPEGImageReader.java 351 2016-10-23 15:15:55Z werner $
    Author:
    Werner Randelshofer
    • Constructor Detail

      • CMYKJPEGImageReader

        public CMYKJPEGImageReader()
      • CMYKJPEGImageReader

        public CMYKJPEGImageReader​(ImageReaderSpi originatingProvider)
    • Method Detail

      • isInvertColors

        public boolean isInvertColors()
        Returns:
        the YCCKInversed property.
      • setInvertColors

        public void setInvertColors​(boolean newValue)
        Parameters:
        newValue - the new value
      • isIgnoreICCProfile

        public boolean isIgnoreICCProfile()
      • setIgnoreICCProfile

        public void setIgnoreICCProfile​(boolean newValue)
      • readImageFromCMYK

        public static BufferedImage readImageFromCMYK​(InputStream in,
                                                      ICC_Profile cmykProfile)
                                               throws IOException
        Reads a CMYK JPEG image from the provided InputStream, converting the colors to RGB using the provided CMYK ICC_Profile. The image data must be in the CMYK color space.

        Use this method, if you have already determined that the input stream contains a CMYK JPEG image.

        Parameters:
        in - An InputStream, preferably an ImageInputStream, in the JPEG File Interchange Format (JFIF).
        cmykProfile - An ICC_Profile for conversion from the CMYK color space to the RGB color space. If this parameter is null, a default profile is used.
        Returns:
        a BufferedImage containing the decoded image converted into the RGB color space.
        Throws:
        IOException
      • readImageFromInvertedCMYK

        public static BufferedImage readImageFromInvertedCMYK​(InputStream in,
                                                              ICC_Profile rgbaProfile)
                                                       throws IOException
        Reads a RGBA JPEG image from the provided InputStream, converting the colors to RGBA using the provided RGBA ICC_Profile. The image data must be in the RGBA color space.

        Use this method, if you have already determined that the input stream contains a RGBA JPEG image.

        Parameters:
        in - An InputStream, preferably an ImageInputStream, in the JPEG File Interchange Format (JFIF).
        rgbaProfile - An ICC_Profile for conversion from the RGBA color space to the RGBA color space. If this parameter is null, a default profile is used.
        Returns:
        a BufferedImage containing the decoded image converted into the RGB color space.
        Throws:
        IOException
      • readImageFromYCCK

        public static BufferedImage readImageFromYCCK​(InputStream in,
                                                      ICC_Profile cmykProfile)
                                               throws IOException
        Reads a YCCK JPEG image from the provided InputStream, converting the colors to RGB using the provided CMYK ICC_Profile. The image data must be in the YCCK color space.

        Use this method, if you have already determined that the input stream contains a YCCK JPEG image.

        Parameters:
        in - An InputStream, preferably an ImageInputStream, in the JPEG File Interchange Format (JFIF).
        cmykProfile - An ICC_Profile for conversion from the CMYK color space to the RGB color space. If this parameter is null, a default profile is used.
        Returns:
        a BufferedImage containing the decoded image converted into the RGB color space.
        Throws:
        IOException
      • readImageFromInvertedYCCK

        public static BufferedImage readImageFromInvertedYCCK​(InputStream in,
                                                              ICC_Profile cmykProfile)
                                                       throws IOException
        Reads an inverted-YCCK JPEG image from the provided InputStream, converting the colors to RGB using the provided CMYK ICC_Profile. The image data must be in the inverted-YCCK color space.

        Use this method, if you have already determined that the input stream contains an inverted-YCCK JPEG image.

        Parameters:
        in - An InputStream, preferably an ImageInputStream, in the JPEG File Interchange Format (JFIF).
        cmykProfile - An ICC_Profile for conversion from the CMYK color space to the RGB color space. If this parameter is null, a default profile is used.
        Returns:
        a BufferedImage containing the decoded image converted into the RGB color space.
        Throws:
        IOException
      • createImageFromYCCK

        public static BufferedImage createImageFromYCCK​(Raster ycckRaster,
                                                        ICC_Profile cmykProfile)
        Creates a buffered image from a raster in the YCCK color space, converting the colors to RGB using the provided CMYK ICC_Profile.
        Parameters:
        ycckRaster - A raster with (at least) 4 bands of samples.
        cmykProfile - An ICC_Profile for conversion from the CMYK color space to the RGB color space. If this parameter is null, a default profile is used.
        Returns:
        a BufferedImage in the RGB color space.
        Throws:
        NullPointerException
      • createImageFromInvertedYCCK

        public static BufferedImage createImageFromInvertedYCCK​(Raster ycckRaster,
                                                                ICC_Profile cmykProfile)
        Creates a buffered image from a raster in the inverted YCCK color space, converting the colors to RGB using the provided CMYK ICC_Profile.
        Parameters:
        ycckRaster - A raster with (at least) 4 bands of samples.
        cmykProfile - An ICC_Profile for conversion from the CMYK color space to the RGB color space. If this parameter is null, a default profile is used.
        Returns:
        a BufferedImage in the RGB color space.
      • createImageFromICCProfile

        public static BufferedImage createImageFromICCProfile​(Raster raster,
                                                              ICC_Profile profile)
        Creates a buffered image from a raster in the color space specified by the given ICC_Profile.
        Parameters:
        raster - A raster.
        profile - An ICC_Profile specifying the color space of the raster.
        Returns:
        a BufferedImage in the color space specified by the profile.
      • createImageFromInvertedCMYK

        public static BufferedImage createImageFromInvertedCMYK​(Raster rgbwRaster,
                                                                ICC_Profile cmykProfile)
        Creates a buffered image from a raster in the RGBW color space. As seen from a comment made by 'phelps' at http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4799903
        Parameters:
        rgbwRaster - A raster with inverted CMYK values (=RGBW).
        cmykProfile - An ICC_Profile. If this parameter is null, a default profile is used.
        Returns:
        a BufferedImage in the RGB color space.
      • readImageFromYCCorGray

        public static BufferedImage readImageFromYCCorGray​(ImageInputStream in)
                                                    throws IOException
        Reads a JPEG image from the provided InputStream. The image data must be in the YUV or the Gray color space.

        Use this method, if you have already determined that the input stream contains a YCC or Gray JPEG image.

        Parameters:
        in - An InputStream, preferably an ImageInputStream, in the JPEG File Interchange Format (JFIF).
        Returns:
        a BufferedImage containing the decoded image converted into the RGB color space.
        Throws:
        IOException
      • dispose

        public void dispose()
        Disposes of resources held internally by the reader.
        Overrides:
        dispose in class ImageReader