Skip to main content

[JAI] 4 band Image conversion to JPEG

1 reply [Last post]
Anonymous

Hello,
I am trying to convert a 4 band image to JPEG using jai package.
Following is the BandCombine matrix i am using.

private final static double [][] matrix = {
{ 1.0D, 0.0D, 0.0D, 0.0D, 0.0D },
{ 0.0D, 1.0D, 0.0D, 0.0D, 0.0D },
{ 0.0D, 0.0D, 1.0D, 0.0D, 0.0D }
};
For this BandCombine matrix i am getting the following error, (I have
printed the colormodel also in my code)

IndexColorModel: #pixelBits = 8 numComponents = 4 color space =
java.awt.color.I
CC_ColorSpace@60420f transparency = 2 transIndex = 1 has alpha = true
isAlphaP
re = false

Exception in thread "main" java.lang.IllegalArgumentException:
BandCombine: a ro
w of the matrix does not have the correct number of entries, should be
OpImage.g
etExpandedNumBands(source0.getSampleModel(), source0.getColorModel()) + 1.
at javax.media.jai.JAI.createNS(JAI.java:900)
at javax.media.jai.JAI.create(JAI.java:786)
at javax.media.jai.JAI.create(JAI.java:1198)
at Sample.main(Sample.java:63)

Please help me with the bandcombine matrix for 4 band images.

Thanks
Vinayak

[att1.html]

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Brian Burkhalter

You need a 3-band output image. Please review the javadoc here:

http://java.sun.com/products/java-media/jai/forDevelopers/jai-apidocs/ja...

Brian

On Mon, 27 Jun 2005, Vinayak Hegde wrote:

> Hello,
> I am trying to convert a 4 band image to JPEG using jai package.
> Following is the BandCombine matrix i am using.
>
> private final static double [][] matrix = {
> { 1.0D, 0.0D, 0.0D, 0.0D, 0.0D },
> { 0.0D, 1.0D, 0.0D, 0.0D, 0.0D },
> { 0.0D, 0.0D, 1.0D, 0.0D, 0.0D }
> };
> For this BandCombine matrix i am getting the following error, (I have
> printed the colormodel also in my code)
>
>
> IndexColorModel: #pixelBits = 8 numComponents = 4 color space =
> java.awt.color.I
> CC_ColorSpace@60420f transparency = 2 transIndex = 1 has alpha = true
> isAlphaP
> re = false
>
> Exception in thread "main" java.lang.IllegalArgumentException:
> BandCombine: a ro
> w of the matrix does not have the correct number of entries, should be
> OpImage.g
> etExpandedNumBands(source0.getSampleModel(), source0.getColorModel()) + 1.
> at javax.media.jai.JAI.createNS(JAI.java:900)
> at javax.media.jai.JAI.create(JAI.java:786)
> at javax.media.jai.JAI.create(JAI.java:1198)
> at Sample.main(Sample.java:63)
>
> Please help me with the bandcombine matrix for 4 band images.
>
> Thanks
> Vinayak
>
>

----------------
Brian Burkhalter
Advanced Development/Media & Entertainment
Market Development Engineering
Sun Microsystems, Inc.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This email message is for the sole use of the intended recipient(s)
and may contain confidential and privileged information. Any
unauthorized review, use, disclosure or distribution is prohibited.
If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai.dev.java.net
For additional commands, e-mail: interest-help@jai.dev.java.net