Even after waiting so many days, the Javafx bug team has not implemented this feature still in this new Javafx General Availability release . So I’ve managed to make blog about this function for javafx. Many javafx enterprises developer may think that javafx is still not useful because they don’t know how to save their graphics component in image format. Developer don’t have a simple api function like sceneToImage() which was provided in javafx script 1.3. Don’t know why ? We developers are that’s why intelligent to find the alternative way. So I also intended to research on this topic.Then started to warmup my hands on keyboard.

We are using some Java apis and JavaFX apis for making these things work. Ok Let’s get started with the class ‘FXImaging’

I’ve commented the codes so that you will understand the use of the function properly. In above class the nodeToImage(),sceneToImage() are the function which help to save your Node or Scene into Image format. The save() function helps to save your bufferedImage from JavaAPI. After saving the image the Node/Scene is being restored to the original stage from where the Node/Scene is being taken. The algorithm of saving Node/Scene is given in the picture below.

Now you can easily save your Node or Scene in the Image format. Below is one of the sample demo of saving the Scene into Image.

Image of Node

Or if you want to make image of whole Scene then use this code:

Image of Scene

It has image like below

Thanks. for watching this blog. You can comment if you have any queries.
Have a good 🙂 day.