The following works fine, displaying the image as it should:
Image img = new Image("file:x.bmp");
System.out.println(img.getHeight()); //Actual image height
StackPane sp = new StackPane();
sp.getChildren().add(new ImageView(img));
primaryStage.setScene(new Scene(sp));
primaryStage.show();
However, if the image constructor is changed to request a resized image instead:
Image img = new Image("file:x.bmp", 200, 200, false, false);
System.out.println(img.getHeight()); //0
StackPane sp = new StackPane();
sp.getChildren().add(new ImageView(img));
primaryStage.setScene(new Scene(sp));
primaryStage.show();
...the image fails to load at all.
The following bug appears to occur with all BMP files (tried 8 and 24 bit), but the correct behaviour occurs for GIF, PNG and JPG files.
Image img = new Image("file:x.bmp");
System.out.println(img.getHeight()); //Actual image height
StackPane sp = new StackPane();
sp.getChildren().add(new ImageView(img));
primaryStage.setScene(new Scene(sp));
primaryStage.show();
However, if the image constructor is changed to request a resized image instead:
Image img = new Image("file:x.bmp", 200, 200, false, false);
System.out.println(img.getHeight()); //0
StackPane sp = new StackPane();
sp.getChildren().add(new ImageView(img));
primaryStage.setScene(new Scene(sp));
primaryStage.show();
...the image fails to load at all.
The following bug appears to occur with all BMP files (tried 8 and 24 bit), but the correct behaviour occurs for GIF, PNG and JPG files.