Issue
I'm trying to convert an JavaFX
Image(from ImageView
) to an BufferedImage
.
I tried casting and stuff but nothing works.
Can someone suggest how i should do this?
Solution
Try your luck with SwingFXUtils. There is a method for that purpose:
BufferedImage fromFXImage(Image img, BufferedImage bimg)
You can call it with second parameter null
, as it is optional (exists for memory reuse reason):
BufferedImage image = SwingFXUtils.fromFXImage(fxImage, null);
Answered By - lukk
Answer Checked By - Mildred Charles (JavaFixing Admin)