Problem with scaling
Hi,
I was using the following code:
InputStream imageData/*= .initialization code*/;
try{
byte[] bytes = FileCopyUtils.copyToByteArray(imageData);
RenderedOp renderedOp = JAI.create("stream",new ByteArraySeekableStream(bytes));// byte[]
ParameterBlock pb =new ParameterBlock();
pb.addSource( renderedOp );
pb.add( 1.0F );
pb.add( 1.0F );
pb.add( 0.0F );
pb.add( 0.0F );
pb.add(new InterpolationBilinear() );
BorderExtender border = BorderExtender.createInstance( BorderExtender.BORDER_COPY );
RenderingHints rh =new RenderingHints( JAI.KEY_BORDER_EXTENDER,border );
PlanarImage pi = JAI.create("scale", pb, rh );
ByteArrayOutputStream os =new ByteArrayOutputStream();
JAI.create("filestore", pi, os,"JPG",null);
return os.toByteArray();
}catch(Exception e){
log.debug("Image exception: "+e.toString());
}
And the output I gott was:
Image exception: java.lang.IllegalArgumentException: FileStore - Para
meter value`s class (java.io.ByteArrayOutputStream) is not an instance of the pa
rameter class (java.lang.String) for parameter "filename".
What could be the reason? Please help.

