public void writeImage(String path, String ext, BufferedImage img) {
        try {
            File f = new File(path);

            f.delete();
            ImageIO.write(img, ext, f);
        } catch (Exception e) {
            ConsoleHelper.appendError("Error while saving file.");
            ConsoleHelper.appendError(e.getMessage());
        }
    }