Add method to save a JavaFX image to file without the use of SwingFXUtils?
Frank Delporte
frank at webtechie.be
Tue May 4 12:08:55 UTC 2021
Hello
My first contribution to this mailing list... ;-)
During an experiment with FXGL on the Raspberry Pi + Gluon JavaFX 17-ea, it turned out there was a missing dependency to javafx.swing.
(also mentioned here <https://stackoverflow.com/questions/50900945/swingfxutils-alternative-for-image-serialization-javafx-swing-raspberry-pi>)
Turns out SwingFXUtils was used in the FXGL library only to be able to save a screenshot of the application to a file and we were able to rework it as you can see here: <https://github.com/AlmasB/FXGL/commit/737c2ba44b9c3e89ed29137ebe7f978b10ac782b>
I researched this topic for a few hours, but didn't manage to find a good approach to save a JavaFX Image. Maybe I missed something? Or wouldn't it be a good idea to extend the JavaFX Image or BufferedImage with e.g. writeToFile(ImageFormat.PNG), writeToFile(ImageFormat.JPG)?
Best regards
Frank Delporte
Want to have coding-fun?
Check my blog<https://webtechie.be/>and book "Getting started with Java on Raspberry Pi" on<https://webtechie.be/books/>
More information about the openjfx-dev
mailing list