Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6211480

Bundled com.sun.image.codec.jpeg JPEG API has errors for a new type of JPEG image

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • 6
    • 1.4.2_04
    • client-libs
    • None
    • 2d
    • beta
    • x86
    • other

        We are trying to use JAI for a new type of JPEG images.
        These are technically "valid" Jpeg images which use color-separated "layers".
        when we create a planar image using these type of images we are getting
        IllegalArgument Exception.

        java.lang.IllegalArgumentException: Tables must be 0, 1, 2, or 3.
                at sun.awt.image.codec.JPEGParam.setDCHuffmanComponentMapping(Unknown So
        urce)

        More information about the JPEG format, Sample code and images is attached

        We used jai-1_1_1_01,JDK1.4 (j2sdk1.4.2_04) we tried using the new
        version of JAI too. It resulted in same exception.
        These JPEG images are generated by a new scanner from IBM called Trac
        II.
        These images are rendered in IE, Microsoft image editor without any
        issues

        Attached zip file has the sample code, jar files, start.bat
        Please take a look at processImage() method in WLIJAIRunTest.java
        Iam also attaching a word document which has details about the JPEG
        image which we are
        trying to process.


        Installation instructions:
        1.Unzip the attached zip file
        2.change start.bat to point to the jar files which are attached in this
        zip.
        3.execute start.bat

        You will get an exception.

        java.lang.IllegalArgumentException: Tables must be 0, 1, 2, or 3.
                at sun.awt.image.codec.JPEGParam.setDCHuffmanComponentMapping(Unknown So
        urce)
                at sun.awt.image.codec.JPEGImageDecoderImpl.readJPEGStream(Native Method
        )
                at sun.awt.image.codec.JPEGImageDecoderImpl.decodeAsBufferedImage(Unknow
        n Source)
                at com.sun.media.jai.codecimpl.JPEGImage.<init>(JPEGImageDecoder.java:11
        2)
                at com.sun.media.jai.codecimpl.JPEGImageDecoder.decodeAsRenderedImage(JP
        EGImageDecoder.java:51)
                at com.sun.media.jai.opimage.CodecRIFUtil.create(CodecRIFUtil.java:89)
                at com.sun.media.jai.opimage.JPEGRIF.create(JPEGRIF.java:52)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                at java.lang.reflect.Method.invoke(Unknown Source)
                at javax.media.jai.FactoryCache.invoke(FactoryCache.java:130)
                at javax.media.jai.OperationRegistry.invokeFactory(OperationRegistry.jav
        a:1669)
                at javax.media.jai.ThreadSafeOperationRegistry.invokeFactory(ThreadSafeO
        perationRegistry.java:481)
                at javax.media.jai.registry.RIFRegistry.create(RIFRegistry.java:340)
                at com.sun.media.jai.opimage.StreamRIF.create(StreamRIF.java:104)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                at java.lang.reflect.Method.invoke(Unknown Source)
                at javax.media.jai.FactoryCache.invoke(FactoryCache.java:130)
                at javax.media.jai.OperationRegistry.invokeFactory(OperationRegistry.jav
        a:1669)
                at javax.media.jai.ThreadSafeOperationRegistry.invokeFactory(ThreadSafeO
        perationRegistry.java:481)
                at javax.media.jai.registry.RIFRegistry.create(RIFRegistry.java:340)
                at javax.media.jai.RenderedOp.createInstance(RenderedOp.java:805)
                at javax.media.jai.RenderedOp.createRendering(RenderedOp.java:853)
                at javax.media.jai.RenderedOp.getRendering(RenderedOp.java:874)
                at javax.media.jai.RenderedOp.createInstance(RenderedOp.java:785)
                at javax.media.jai.RenderedOp.createRendering(RenderedOp.java:853)
                at javax.media.jai.RenderedOp.getRendering(RenderedOp.java:874)
                at javax.media.jai.RenderedOp.createInstance(RenderedOp.java:785)
                at javax.media.jai.RenderedOp.createRendering(RenderedOp.java:853)
                at javax.media.jai.RenderedOp.getColorModel(RenderedOp.java:2198)
                at WLIJAITest.processImage(WLIJAIRunTest.java:176)
                at WLIJAITest.run(WLIJAIRunTest.java:107)
        java.lang.reflect.InvocationTargetException
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                at java.lang.reflect.Method.invoke(Unknown Source)
                at javax.media.jai.FactoryCache.invoke(FactoryCache.java:130)
                at javax.media.jai.OperationRegistry.invokeFactory(OperationRegistry.jav
        a:1669)
                at javax.media.jai.ThreadSafeOperationRegistry.invokeFactory(ThreadSafeO
        perationRegistry.java:481)
                at javax.media.jai.registry.RIFRegistry.create(RIFRegistry.java:340)
                at javax.media.jai.RenderedOp.createInstance(RenderedOp.java:805)
                at javax.media.jai.RenderedOp.createRendering(RenderedOp.java:853)
                at javax.media.jai.RenderedOp.getRendering(RenderedOp.java:874)
                at javax.media.jai.RenderedOp.createInstance(RenderedOp.java:785)
                at javax.media.jai.RenderedOp.createRendering(RenderedOp.java:853)
                at javax.media.jai.RenderedOp.getRendering(RenderedOp.java:874)
                at javax.media.jai.RenderedOp.createInstance(RenderedOp.java:785)
                at javax.media.jai.RenderedOp.createRendering(RenderedOp.java:853)
                at javax.media.jai.RenderedOp.getColorModel(RenderedOp.java:2198)
                at WLIJAITest.processImage(WLIJAIRunTest.java:176)
                at WLIJAITest.run(WLIJAIRunTest.java:107)
        Caused by: java.lang.RuntimeException: Unable to process image stream, incorrect
         format.
                at com.sun.media.jai.codecimpl.JPEGImage.<init>(JPEGImageDecoder.java:11
        4)
                at com.sun.media.jai.codecimpl.JPEGImageDecoder.decodeAsRenderedImage(JP
        EGImageDecoder.java:51)
                at com.sun.media.jai.codec.ImageDecoderImpl.decodeAsRenderedImage(ImageD
        ecoderImpl.java:148)
                at com.sun.media.jai.opimage.StreamRIF.create(StreamRIF.java:135)
                ... 19 more
        java.lang.RuntimeException: - Unable to render RenderedOp for this operation.
                at javax.media.jai.RenderedOp.createInstance(RenderedOp.java:813)
                at javax.media.jai.RenderedOp.createRendering(RenderedOp.java:853)
                at javax.media.jai.RenderedOp.getRendering(RenderedOp.java:874)
                at javax.media.jai.RenderedOp.createInstance(RenderedOp.java:785)
                at javax.media.jai.RenderedOp.createRendering(RenderedOp.java:853)
                at javax.media.jai.RenderedOp.getRendering(RenderedOp.java:874)
                at javax.media.jai.RenderedOp.createInstance(RenderedOp.java:785)
                at javax.media.jai.RenderedOp.createRendering(RenderedOp.java:853)
                at javax.media.jai.RenderedOp.getColorModel(RenderedOp.java:2198)
                at WLIJAITest.processImage(WLIJAIRunTest.java:176)
                at WLIJAITest.run(WLIJAIRunTest.java:107)
        java.lang.NullPointerException
                at WLIJAITest.processImage(WLIJAIRunTest.java:194)
                at WLIJAITest.run(WLIJAIRunTest.java:107)
        ###@###.### 2004-12-21 22:44:28 GMT

        The problem is in the bundled com.sun.image.codec.jpeg JPEG decoder, not in JAI per se. This may be verified by attempting to load the image SA-8507_00012.jpg contained in the attached Zip archive using the attached test class JPEGTest.
        ###@###.### 2004-12-22 00:19:27 GMT

              bae Andrew Brygin
              cprasadsunw Ck Prasad (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: