ColorModel, tif and JAI problem

O

ownowl

Hello

I need to modify the color model of a PlanarImage (colors to grays scale
and other operations)

The original planarImage is built with a byte array that come from a
tiff file :

SeekableStream stream = new ByteArraySeekableStream(data);
RenderedImage im = JAI.create("stream", stream);
planarImage = PlanarImage.wrapRenderedImage(im);

planarImage is a instance of RenderedOp
the sampleModel of the planarImage is a PixelInterleavedSampleModel
the colorModel of the planarImage is a IndexColorModel

I tried it since several hours without success. So I not found in JAI
documentation all string_option of JAI.create(string_option, object) and
their signification.


thank for all idea
Olivier
 
O

ownowl

ownowl a écrit :
Hello

I need to modify the color model of a PlanarImage (colors to grays scale
and other operations)

The original planarImage is built with a byte array that come from a
tiff file :

SeekableStream stream = new ByteArraySeekableStream(data);
RenderedImage im = JAI.create("stream", stream);
planarImage = PlanarImage.wrapRenderedImage(im);

planarImage is a instance of RenderedOp
the sampleModel of the planarImage is a PixelInterleavedSampleModel
the colorModel of the planarImage is a IndexColorModel

I tried that :

ImageLayout layout = new ImageLayout();
ColorModel cm = new
ComponentColorModel(ColorSpace.getInstance(ColorSpace.CS_sRGB), new
int[] { 8, 8, 8 }, false, true, Transparency.OPAQUE, DataBuffer.TYPE_BYTE);

layout.setColorModel(cm);
RenderingHints hints = new
RenderingHints(JAI.KEY_IMAGE_LAYOUT, layout);

ParameterBlockJAI pb = new ParameterBlockJAI("format");
pb.addSource(planarImage);
planarImage = JAI.create("format", pb, hints);

with using ColorSpace.CS_GRAY parameter for the ColorSpace.getInstance()
methode I get a gray scale level image.

But I can not modify the intensity of colors or gray scale level.
A idea ?

Olivier
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,154
Members
46,702
Latest member
LukasConde

Latest Threads

Top