I am trying to get the images (blob) from DB and adding it to a tableview JavaFX
But the quality is drastically reducing, even color is inverted. Any solution for this?
My code :
Main Form
for (StudentDTO s : studentDTOS) {
ImageView img = ImageController.blobToImage(s.getImage());
Button btn = new Button("Edit");
tmList.add(new ReceptionistStudentTM(
s.getId(),
img,
s.getName(),
s.getEmail(),
s.getNic(),
s.getScholaMark(),
s.isStatus(),
btn
));
}
tblStudents.setItems(tmList);
ImageController.java
public class ImageController {
public static ImageView blobToImage(Blob blob) throws SQLException {
return new ImageView(new Image(blob.getBinaryStream()));
}
}
Thanks for your time