Page 1 of 1

Creating a jpg in memory

Posted: Mon May 05, 2008 6:55 pm
by 7667581
I am having trouble generating the appropriate java code in order to use this method

save
public void save(javax.imageio.stream.ImageOutputStream ios)

I am currently passing in the file name to this method

save
public void save(java.lang.String fileName)


However for our web version we only have easy access to the relative path - therefore I want to retrieve the jpg file in memory then write it to disk outside of teechart.

Sample code would be very helpful.

Posted: Tue May 06, 2008 10:11 am
by narcis
Hi cathy,

You can save a chart to a stream doing something like this:

Code: Select all

        ImageOutputStream ios = ImageIO.createImageOutputStream( new FileOutputStream(fileName));
        chart1.getExport().getImage().getJPEG().save(ios);
Hope this helps!