File file = chooser.getFile().showOpenDialog(new Stage());
String path;
try {
path = file.getPath();
FileInputStream fileInputStream = new FileInputStream(path);
javafx.scene.image.Image image = new javafx.scene.image.Image(fileInputStream);
Canvas canvas = new Canvas();
GraphicsContext graphicsContext = canvas.getGraphicsContext2D();
graphicsContext.drawImage(image, 0, 0);
} catch (Exception e){
e.printStackTrace();
}