Converting JPEG image from CMYK format to  RGB Format

Posted on 2006-05-25
Last Modified: 2010-05-19

Hi Experts

I am facing Some problem in Converting CMYK to RGB format for JPEG image.

When I am reading the jpeg image of format CMYK at that time itself i am getting exception.

If anybody know the solution please help me.

I followed some methods for reading the image.

   Image inImage = new ImageIcon("c:\\test1.jpg").getImage();

     sun.awt.image.ImageFormatException: Unsupported color conversion request
     at sun.awt.image.JPEGImageDecoder.readImage(Native Method)
     at sun.awt.image.JPEGImageDecoder.produceImage(Unknown Source)
     at sun.awt.image.InputStreamImageSource.doFetch(Unknown Source)
     at sun.awt.image.ImageFetcher.fetchloop(Unknown Source)
      at Source)

2)Second Method

   BufferedImage image2 =;

          javax.imageio.IIOException: Unsupported Image Type
          javax.imageio.IIOException: Unsupported Image Type
        at com.sun.imageio.plugins.jpeg.JPEGImageReader.readInternal(Unknown Source)
        at Source)
        at Source)
        at Source)
        at JpedalExample.main(

3)Third Method

     RenderedImage image =JAI.create("fileload", "c:\\test1.jpg");

       Error: One factory fails for the operation "jpeg"

          Caused by: Unable to process
          image stream, incorrect format.
          Caused by: com.sun.image.codec.jpeg.ImageFormatException: Can't construct a Buff
          eredImage for given COLOR_ID
          Caused by: All factories fail for the ope
         ration "jpeg"

4) Fourth method

         RenderedOp op = JAI.create("stream", new FileSeekableStream(infile));
           Error: One factory fails for the operation "jpeg"
          Occurs in: java.lang.reflect.InvocationTargetException

Question by:calju
    LVL 6

    Expert Comment

    Hello Dear
     Use PlanarImage to read file. PlanarImage is class of JAI
     such as
      PlanarImage srcImg = JAI.Create("fileload",path);

    best regards
    LVL 6

    Accepted Solution


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
    Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
    Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
    The viewer will learn how to implement Singleton Design Pattern in Java.

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now