title: javafx snapshot without showing application or Scene
body: <p>Hi i'm using JavaFx WebView to create Screenshot of HTML pages and it works fine but i wanted to know is it possible to do this without launching the application in Graphical Windows!! I mean aren't there any more lightweight method to get the screenshot then this:</p>
  
  <pre><code>public class WebViewSample extends Application {
      private Scene scene;
  
      @Override
      public void start(Stage stage) {
          // create scene
          scene = new Scene(new Browser(snapshot), 750, 500, Color.web("#666970"));
  
          stage.setScene(scene);
  //        show stage
          stage.show();
      }
      WritableImage snapshot;
      public static void main(String[] args) {
          launch(args);
          System.err.println("launched!");
      }
  }
  class Browser extends Region {
  
  
      final ImageView selectedImage = new ImageView();
      final WebView browser = new WebView();
      final WebEngine webEngine = browser.getEngine();
      private final  WritableImage snapshotImage;
  
      public Browser(WritableImage snapshot) {
          this.snapshotImage= snapshot;
          // process page loading
          webEngine.getLoadWorker().stateProperty().addListener(
                  new ChangeListener&lt;State&gt;() {
                      @Override
                      public void changed(ObservableValue&lt;? extends State&gt; ov,
                                          State oldState, State newState) {
                          if (newState == State.SUCCEEDED) {
                              WritableImage newSnapshot = browser.snapshot(null, snapshotImage);
                              File file = new File("test2.png");
                              RenderedImage renderedImage = SwingFXUtils.fromFXImage(newSnapshot, null);
                              try {
                                  ImageIO.write(renderedImage, "png", file);
                              } catch (IOException e1) {
                                  e1.printStackTrace();
                              }
                              System.exit(0);
                          }
                      }
                  }
          );
  
          // load the home page        
          webEngine.load("http://localhost/");
  
  
          //add components
          getChildren().add(browser);
      }
  
  
  
  }  
  </code></pre>