Creating a jpg in memory

TeeChart for Java (NetBeans, Eclipse, Android Studio, etc)
Post Reply
cathy
Newbie
Newbie
Posts: 8
Joined: Tue Mar 11, 2008 12:00 am

Creating a jpg in memory

Post by cathy » Mon May 05, 2008 6:55 pm

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.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue May 06, 2008 10:11 am

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!
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply