0

I'm using JAI(Java Advanced Image Processing) library.

I try to read one image as BufferedImage using jai.

jai allocate huge size of byte array to read the image.

jai using about 1.5GB memory although the image size is only about 1.5MB.

i don't know why this happening.

following code is that i'm using to read the image.

import javax.media.jai.JAI;
import javax.media.jai.RenderedOp;
import java.awt.image.BufferedImage;

    public BufferedImage getBufferedImage(String fileName) {
        RenderedOp op = JAI.create("url", new URL(fileName));
        return op.getAsBufferedImage();
    }

And the image url that occured this situation is,

http://blogfiles.naver.net/20140405_244/fromspirit_1396696576082Tx8oc_PNG/POIDF0021.PNG

I hope any advice or help.

thanks!

  • And an exception occured when read the image.

    java.lang.RuntimeException: - Unable to render RenderedOp for this operation. at javax.media.jai.RenderedOp.createInstance(RenderedOp.java:827) at javax.media.jai.RenderedOp.createRendering(RenderedOp.java:867) at javax.media.jai.RenderedOp.getColorModel(RenderedOp.java:2242) at javax.media.jai.PlanarImage.getAsBufferedImage(PlanarImage.java:2498) at javax.media.jai.PlanarImage.getAsBufferedImage(PlanarImage.java:2546) ...

SHRIN
  • 318
  • 3
  • 15
  • Image (file) size and memory consumption are not closely related. Memory consumption depends on image dimensions and color depth. But the image you refer does look like it should need 1.5 GB. It does seem broken (at least my browser displays it with trashed last lines), however, which could explain why JAI does weird things. Also, how do you measure that JAI uses 1.5 GB for this image? – Harald K Apr 14 '14 at 07:46
  • thanks for help. I use VisualVM to measure memory usage. and reading the image an exception occurred. The trace is appended to question. – SHRIN Apr 14 '14 at 08:07

0 Answers0