public static void write(RenderedImage image, File file, boolean borderless) {
		if (!borderless) {
			if (image instanceof BufferedImage) {
				BufferedImage bi = (BufferedImage) image;
				int x = bi.getMinX();
				int y = bi.getMinY();
				int w = bi.getWidth();
				int h = bi.getHeight();
				for (int i = x; i < x + w; i++) {
					bi.setRGB(i, y, 0x000000);
					bi.setRGB(i, y + h - 1, 0x000000);
				}
				for (int i = y; i < y + h; i++) {
					bi.setRGB(x, i, 0x000000);
					bi.setRGB(x + w - 1, i, 0x000000);
				}
			}
		}
		OutputStream out = null;
		try {
			out = new FileOutputStream(file);
			ImageIO.write(image, FileUtilities.getExtensionInLowerCase(file), out);
		}
		catch (IOException e) {
			e.printStackTrace();
		}
		finally {
			if (out != null) {
				try {
					out.close();
				}
				catch (IOException e) {
				}
			}
		}
	}