What I want to do is take a screenshot of the scene, I achieved this with the following code
WritableImage snapshot = stage.getScene().snapshot(null);
File file = new File("src//HE//Utilidades//Imagenes//consul.png");
try {
ImageIO.write(SwingFXUtils.fromFXImage(snapshot, null), "png", file);
//this is for open the screenshot
Desktop dt = Desktop.getDesktop();
dt.open(file);
} catch (IOException e) {
e.printStackTrace();
}
The screenshot is perfect the problem I have is with the quality of the screenshot , which i dont know of what dependents , I try to make the scene bigger but the quality of dpi remains the same (70) creating a very unpleasant image, i'm looking a way to improve the dpi of the screenshot at least 300dpi for printing
A simple sceenshot is a screenshot and not a high-resolution rendering of your scene. You will not be able to get more pixels into your image than there are on your screen. So unless you have a 300 DPI screen, then what you want is not possible with a simple screenshot.
If you want a higher resolution image of your scene then you have to use other techniques like offscreen rendering. An example can be found here: