Java examples for JavaFX:Image
write JavaFX Node To Image
//package com.java2s; import java.io.File; import java.io.IOException; import javafx.embed.swing.SwingFXUtils; import javafx.scene.Node; import javafx.scene.SnapshotParameters; import javafx.scene.image.WritableImage; import javax.imageio.ImageIO; public class Main { public static void writeNodeToImage(Node n, File f) { WritableImage snapshot = n.snapshot(new SnapshotParameters(), null); try {// ww w . j a va2 s. c o m ImageIO.write(SwingFXUtils.fromFXImage(snapshot, null), "png", f); } catch (IOException e) { // TODO: handle exception here } } }