• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4958
  • Last Modified:

Converting JPEG image from CMYK format to RGB Format


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.

1)Firstmethod
   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 sun.awt.image.ImageFetcher.run(Unknown Source)


2)Second Method

   BufferedImage image2 = ImageIO.read(infile);

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

3)Third Method


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

       Error: One factory fails for the operation "jpeg"

          Caused by: com.sun.media.jai.codecimpl.util.ImagingException: 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: javax.media.jai.util.ImagingException: 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: javax.media.jai.ThreadSafeOperationRegistry java.lang.reflect.InvocationTargetException



0
calju
Asked:
calju
  • 2
1 Solution
 
MuhammadAdilCommented:
Hello Dear
 Use PlanarImage to read file. PlanarImage is class of JAI
 such as
  PlanarImage srcImg = JAI.Create("fileload",path);

best regards
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now