JavaFX [1.3] - Save As Image


JavaFX - Save As Image code updated to be compatible with JavaFX 1.3
Please refer to JavaFX13Utils.fx for more information. You will need to update only if you are using internal APIs as mentioned in this forum thread.

<script src="http://dl.javafx.com/1.3/dtfx.js"></script> <script src="http://javafxdemos.googlecode.com/hg/resource/SaveAsImage/1.3/SaveAsImage.js"></script>

For Applet mode, click on above image

For standalone mode

Try it out and let me know feedback

Comments:

Excellent and Thanks for sharing this code. We are using this code to send FX whiteboard to clients.

Posted by Raghu Nair on April 27, 2010 at 09:08 AM IST #

Hi Rakech,
Why "saveAsImage" write image without extension "png"?
thanks

Posted by Alex on May 10, 2010 at 11:28 AM IST #

Hi Rakesh,

Thanks for sharing this usefull code.

Do you thing it's possible to save as an image something I don't show in the scene?

Eg : I want to save some javaFX charts as an Image, but I don't want my user to see this charts in the scene.

I try to create a new scene with visible:false , It work on macOS but not on Windows and I don't think this method is clean.

Posted by Christophe DUFOUR on May 11, 2010 at 10:44 AM IST #

@Christophe DUFOUR I think there is some optimization done, thus it fails for off-screen rendering (It was working for 1.2). Have to investigate this scenario..

Posted by Rakesh Menon on May 12, 2010 at 02:47 AM IST #

@Alex As of now I'm just using the file returned by JFileChooser, so it will not have extension if user doesn't enter it. We can enhance this to check the name of file name and append ".png" if it doesn't exist

Posted by Rakesh Menon on May 12, 2010 at 02:49 AM IST #

Post a Comment:
Comments are closed for this entry.
About


The views expressed on this blog are my own and do not necessarily reflect that of my organization

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today