Skip to main content

[JAI-IMAGEIO] RE: adding alpha band

3 replies [Last post]
Anonymous

Hi,

I need to transcode 3band RGB geotiff images to ARGB png. Is
this possible using JAI?

I tried PNGEncodeParam.RGB parameter to set RGB 0,0,0 to
transparent like this:

param.setTransparentRGB(new int[] { 0, 0, 0}); before encoding to PNG.

Although this worked for some rendering clients it did not for
the IE browser app I need to use. Apparently I need to furnish the alpha
band as well.

Thanks

rkgeorge

[att1.html]

Reply viewing options

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

Hi,

Thanks for the quick response.

Using Image I/O instead of JAI:
Is there an existing TIFF/PNG or PNG/PNG codec for RGB to ARGB or is this a
writer plugin I need to create?

http://java.sun.com/j2se/1.5.0/docs/guide/imageio/spec/extending.fm4.html

Thanks
Randy

-----Original Message-----
From: Brian.Burkhalter@Sun.COM [mailto:Brian.Burkhalter@Sun.COM]
Sent: Monday, September 11, 2006 4:46 PM
To: 'JAI-Image I/O discussion list'
Subject: Re: [JAI-IMAGEIO] RE: adding alpha band

On Mon, 11 Sep 2006, Randy George wrote:

> Hi,
>
> I need to transcode 3band RGB geotiff images to ARGB png. Is
> this possible using JAI?

Yes.

> I tried PNGEncodeParam.RGB parameter to set RGB 0,0,0 to
> transparent like this:
>
> param.setTransparentRGB(new int[] { 0, 0, 0}); before encoding to PNG.

You are referring to the com.sun.media.jai.codec classes which are part of
JAI, not JAI Image I/O. If you are just starting I recommend the latter.

> Although this worked for some rendering clients it did not for
> the IE browser app I need to use. Apparently I need to furnish the alpha
> band as well.

Yes.

Brian

----------------
Brian Burkhalter
Java Media, Imaging, and Graphics
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-imageio.dev.java.net
For additional commands, e-mail: interest-help@jai-imageio.dev.java.net

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

Brian Burkhalter

There shouldn't be any need to write a plug-in. It's just a matter of copying
data. If you're not dealing with large images you could just do it with
BufferedImage. For example you could create a TYPE_4BYTE_ABGR BufferedImage,
obtain its Raster, and then copy data into 3- and 1-band children of the
WritableRaster to populate the RGB and alpha bands, respectively.

Brian

On Tue, 12 Sep 2006, Randy George wrote:

> Hi,
>
> Thanks for the quick response.
>
> Using Image I/O instead of JAI:
> Is there an existing TIFF/PNG or PNG/PNG codec for RGB to ARGB or is this a
> writer plugin I need to create?
>
> http://java.sun.com/j2se/1.5.0/docs/guide/imageio/spec/extending.fm4.html
>
> Thanks
> Randy

----------------
Brian Burkhalter
Java Media, Imaging, and Graphics
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-imageio.dev.java.net
For additional commands, e-mail: interest-help@jai-imageio.dev.java.net

Brian Burkhalter

On Mon, 11 Sep 2006, Randy George wrote:

> Hi,
>
> I need to transcode 3band RGB geotiff images to ARGB png. Is
> this possible using JAI?

Yes.

> I tried PNGEncodeParam.RGB parameter to set RGB 0,0,0 to
> transparent like this:
>
> param.setTransparentRGB(new int[] { 0, 0, 0}); before encoding to PNG.

You are referring to the com.sun.media.jai.codec classes which are part of
JAI, not JAI Image I/O. If you are just starting I recommend the latter.

> Although this worked for some rendering clients it did not for
> the IE browser app I need to use. Apparently I need to furnish the alpha
> band as well.

Yes.

Brian

----------------
Brian Burkhalter
Java Media, Imaging, and Graphics
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-imageio.dev.java.net
For additional commands, e-mail: interest-help@jai-imageio.dev.java.net