This discussion is archived
3 Replies Latest reply: Sep 12, 2010 6:37 AM by 843802 RSS

Add two image ERROR!

843802 Newbie
Currently Being Moderated
Hi! i have some problem with this code:
     public BufferedImage combineYUV2(BufferedImage ydctmark, BufferedImage bi) {
          // Read the two images.
          ParameterBlock pb = new ParameterBlock();
          RenderedImage src1 = (RenderedImage)JAI.create("stream", pb);
          pb = new ParameterBlock();
          RenderedImage src2 = (RenderedImage)JAI.create("stream", pb);
          // Create the ParameterBlock for the operation
          pb = new ParameterBlock();
          // Create the Add operation.
          RenderedImage dst = (RenderedImage)JAI.create("add", pb);

          int w=bi.getWidth();
          int h = bi.getHeight();
          int[] img = new int[w*h]; 
          dst.getData().getPixels(0, 0, w, h, img);
          BufferedImage image = new BufferedImage(w, h, BufferedImage.TYPE_CUSTOM);
          WritableRaster raster = image.getRaster();
          raster.setPixels(0, 0, w, h, img);
          return image;

and i don't understand why.

the error is : " Exception in thread "main" java.lang.IllegalArgumentException: operation "Stream" requires 2 parameter object(s).
     at" ext...

can some one help me?

to create this method i read this