No. If the original Image no longer a BufferedImage . Then you can just throw:
BufferedImage bufImg = null; if (origImage instanceof BufferedImage) { bufImg = (BufferedImage) origImage; else { bugImg = new BufferedImage(...);
If it is not a BufferedImage , it could be, for example, VolatileImage (another specific subclass in the API).
From documents on a flying image:
VolatileImage is an image that may lose its contents at any time due to circumstances beyond the control of the application (for example, situations caused by the operating system or other applications).
As you can imagine, such an image cannot provide the same interface as BufferedImage , so the only way to get BufferedImage is to create it and draw the original image on top of it.
source share