1

I'm trying to create a GridPane containing images of equal height and width. I've put each ImageView into a Pane because without the Pane the ImageView elements don't seem to scale correctly. It kinda works with the Pane, but the quality of the ImageView gets degraded.

public class Cell extends Pane{

public Cell(FieldCell field){
    this.field = field;

    image = new ImageView(new Image("path"));

    image.fitHeightProperty().bind(this.heightProperty());
    image.fitWidthProperty().bind(this.widthProperty());

    this.getChildren().add(image);
}

That's the Code.

Original Picture:

enter image description here

When inserted into a Pane:

enter image description here

I've also used other Pictures.

Maybe it doesn't look that bad in your opinion but if I use ImageView only and set the Width (not fitWidth) it looks much better.

user812786
  • 4,302
  • 5
  • 38
  • 50
kilian eller
  • 184
  • 2
  • 16
  • 1
    It's difficult to know what your issue is. A related question is: [JavaFX ImageView without any smoothing](http://stackoverflow.com/questions/16089304/javafx-imageview-without-any-smoothing), though that answer may not assist you. – jewelsea Mar 22 '17 at 19:53
  • well this is upscaling not downscaeing – kilian eller Mar 22 '17 at 19:58
  • What is upscaling? Rendering an image in an area larger than the image bitmap itself? If so, how much larger? 20%, 500%? If you do that with a bitmap, you are either going to get jaggy images (if no smoothing algorithm is applied) or blurry images (if a smoothing algorithm is applied). Vector based image formats (such as svg) will scale up and down smoothly, but JavaFX does not directly support them, though you can get the basics to work if you search related answers on StackOverflow. – jewelsea Mar 22 '17 at 20:03
  • i meant your link is upscaling my Problem is downscaling – kilian eller Mar 22 '17 at 23:07

0 Answers0