public static int toBufferedImageType(Image.ImageType type) {
		switch(type) {
		case GREYSCALE:
			return BufferedImage.TYPE_BYTE_GRAY;
		case COLOR:
			return BufferedImage.TYPE_INT_RGB;
		default:
			throw new IllegalArgumentException();
		}
	}