file to image javafx

Java
  Image image = new Image(new FileInputStream(selectedFile));
  previewPicture.setImage(image);
Source

Also in Java: