Skip to main content

Problem wirth MultiplyConst operation

1 reply [Last post]
Joined: 2010-03-20
Points: 0

I am applying "MultiplyConst" operation. My input image is of 8 bit. After multiplying by a constant the resultant image pixels have values greater than 255, so I want resultant Image in 16 bit. However, it is mentioned that "by default, the destination image bound, data type, and number of bands are the same as the source image". My source Image is of 8 bit, but I want my destination Image in 16 bit. Please advise my how to that ?

My code is:
ParameterBlock pb2 = new ParameterBlock();
pb2.addSource(image1); // The source image
PlanerImage image2=JAI.create("MultiplyConst", pb2);

Here, image1 is of 8 bit. But the Constant by which I am multiplying the image is high so I want image2 is of 16 bit, however, at the movement this operation is clamping the pixel values in between 0 to 255. Please advise me what to do to change bound of destination image.
Thanks in advance !

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2010-03-20
Points: 0

Thanks !

I have got the solution. It is very simple.
Just need to change the format of image from BYTE to USHORT.

ParameterBlock pbConvert = new ParameterBlock();
Image = JAI.create("format", pbConvert);