I think I almost have it. But I can’t figure out how to write the image file.
def output(fileName: String) = {
import javafx.embed.swing.SwingFXUtils._
import java.awt.image.BufferedImage._
val bimg = new java.awt.image.BufferedImage(width,height,TYPE_INT_ARGB)
toFXImage(bimg,wimg)
bimg.???
}