Skip to main content

Adding a ColorModel to a RenderedImage

1 reply [Last post]
deadpassive
Offline
Joined: 2009-02-05
Points: 0

Hi,

After carrying out a Multiply operation on two RenderedImages, the result seems to not have a ColorModel so I can't save it to a file. How do I give a RenderedImage a ColorModel?

I'm only interested in the raw data of the image, so I'm not sure I'm even interested in the ColorModel itself, but I need to be able to save it to a file

Thanks,

Jon

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Nidel, Mike

try this -- no guarantees though.

1. create the appropriate ColorModel
2. create an ImageLayout and call setColorModel()
3. pass the image layout to a RenderingHints with JAI.KEY_IMAGE_LAYOUT (or whatever it is)
4. pass the RenderingHints to your JAI operator, or a Format operation at the end of the chain.

good luck,

> -----Original Message-----
> From: jai-interest@javadesktop.org [mailto:jai-
> interest@javadesktop.org]
> Sent: Wednesday, January 27, 2010 10:20 AM
> To: interest@jai.dev.java.net
> Subject: [JAI] Adding a ColorModel to a RenderedImage
>
> Hi,
>
> After carrying out a Multiply operation on two RenderedImages, the
> result seems to not have a ColorModel so I can't save it to a file.
> How do I give a RenderedImage a ColorModel?
>
> I'm only interested in the raw data of the image, so I'm not sure I'm
> even interested in the ColorModel itself, but I need to be able to save
> it to a file
>
> Thanks,
>
> Jon
> [Message sent by forum member 'deadpassive'
> (man_kills_everything@hotmail.com)]
>
> http://forums.java.net/jive/thread.jspa?messageID=383281
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@jai.dev.java.net
> For additional commands, e-mail: interest-help@jai.dev.java.net

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