public CoreBufferedImage write(String file) {
        if (file == null) return this;

        if (size() != 1) {
            this.commonCore.report(MessageType.MISUSE, "CoreBufferedImage.write() needs exactly one image to write, at the moment.");
        }

        String type = "png";
        type = file.toLowerCase().endsWith(".gif") ? "GIF" : type;
        type = file.toLowerCase().endsWith(".jpg") ? "JPG" : type;
        type = file.toLowerCase().endsWith(".jpeg") ? "JPG" : type;
        type = file.toLowerCase().endsWith(".bmp") ? "BMP" : type;
        type = file.toLowerCase().endsWith(".wbmp") ? "WBMP" : type;

        try {
            ImageIO.write(get(0), type, new File(file));
        } catch (IOException e) {
            this.commonCore.report(MessageType.EXCEPTION, "Error writing image to file " + file);
        }

        return this;
    }