static BufferedImage toBufferedImageOpt(O o) { if (o instanceof BufferedImage) ret (BufferedImage) o; if (o instanceof MakesBufferedImage) ret o/MakesBufferedImage.getBufferedImage(); S c = getClassName(o); // Keep this because it also works on imported objects if (eqOneOf(c, "main$BWImage", "main$RGBImage")) ret (BufferedImage) call(o, "getBufferedImage"); if (eq(c, "main$PNGFile")) ret (BufferedImage) call(o, "getImage"); null; }