If you are getting back a sun.awt.image.ToolkitImage
, you can cast the Image to that, and then use getBufferedImage() to get the BufferedImage
.
So instead of your last line of code where you are casting you would just do:
BufferedImage buffered = ((ToolkitImage) image).getBufferedImage();