Loss of colour when rendering JPEG

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Simon

Loss of colour when rendering JPEG

Post by Simon » Thu Sep 19, 2002 11:07 am

Hi,

I get a loss of colour when encoding a JPEG from the BufferedImage retrieved from the createBufferedImage method on the JFreeChart class.

I am using the standard sun 'com.sun.image.codec.jpeg.JPEGCodec' and
'com.sun.image.codec.jpeg.JPEGImageEncoder' classes.

For example. If I get set a series paint to RBG(255,0,0). I'd expect this colour on the JPEG, however, the colour of the series is more like a paler red (200, 10, 10).

Documentation about the BufferedImage indicates when you create a BufferedImage you set what type of colour table it should use. However, I don't seem to be able to tell JFreeChart to use a different BufferedImage colour table type before called 'createdBufferedImage'. Has anybody had any other similar colour problems? And how did you resolve them?

Many thanks
Simon

Andreas Schroeder

Re: Loss of colour when rendering JPEG

Post by Andreas Schroeder » Thu Sep 19, 2002 11:20 am

Hi Simon,

I'm not shure if i understood your problem. But maybe this can help you out: you can create your own BufferedImage, then create a graphics2D object and use the JFreeChart.draw(Graphics2D, Rectange2D) method.

Then you can configure the color-settings of your image at free will (while you create the image).

Hope that helps you,

Regards,

Andreas Schroeder

Simon

Re: Loss of colour when rendering JPEG

Post by Simon » Thu Sep 19, 2002 11:33 am

Thank you, that seems to have done the trick!!

Locked