sending chart image in gif format

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
kapilkaps83
Posts: 9
Joined: Fri Jun 13, 2008 4:09 am
Location: Japan

sending chart image in gif format

Post by kapilkaps83 » Fri Jun 13, 2008 4:15 am

hi
i have able to send jpeg,png formats on the browser but for mobile application i need to send it in gif format.

the code part is

JFreeChart chart = ChartFactory.createPieChart(Title,dataset,false,false);

response.setContentType("image/png");
ChartUtilities.writeChartAsPNG(out, chart, 400, 300);

how can i set the image in gif format.

Please help

RichardWest
Posts: 844
Joined: Fri Oct 13, 2006 9:29 pm
Location: Sunnyvale, CA

Re: sending chart image in gif format

Post by RichardWest » Fri Jun 13, 2008 4:50 am

kapilkaps83 wrote:how can i set the image in gif format.
GIF, or Graphics Interchange Format, is a patented image format and encoding/decoding algorithm. There have been some controversy over the licensing issues associated with GIF which is why few open source applications use GIF for images. The PNG, or Portable Network Graphics, is an ISO standard and, therefore, not subject to any licensing issues. As all geeks know, PNG stands for "PNG's not GIF" which has that nice recursive quality. Are the mobile devices only able to display GIF, or do they just assume all byte data is a GIF? If you send the image with the MIME type 'image/png', the device would certainly know the data should be interpreted as a PNG image.
Richard West
Design Engineer II
Advanced Micro Devices
Sunnyvale, CA

kapilkaps83
Posts: 9
Joined: Fri Jun 13, 2008 4:09 am
Location: Japan

Post by kapilkaps83 » Fri Jun 13, 2008 4:59 am

Actually in japan we have three service providers therefore as per their standards one of them only display gif images only.

i think of using GIfEncoder but dont know how to use

can u help?

RichardWest
Posts: 844
Joined: Fri Oct 13, 2006 9:29 pm
Location: Sunnyvale, CA

Post by RichardWest » Fri Jun 13, 2008 5:06 am

kapilkaps83 wrote:can u help?
No, but Google can if you know which version of GifEncoder you are using. It seems that there are multiple classes with that name, but most seem like they take an Image object as part of the constructor and an OutputStream either as an argument to the constructor or a write method. It is important to note that most of these sites make a note about the possible patent implications, but that will probably not be an issue if you are just an individual.
Richard West
Design Engineer II
Advanced Micro Devices
Sunnyvale, CA

Locked