public static Pair<ImageFormat, ByteBuffer> s_imageToByteBuffer(BufferedImage img) {
		int fmtInt = img.getType();
		switch(fmtInt) {
		case BufferedImage.TYPE_BYTE_GRAY: return new Pair<ImageFormat, ByteBuffer>(ImageFormat.R, s_imageGreyscaleToByteBuffer(img));

		case BufferedImage.TYPE_4BYTE_ABGR: return new Pair<ImageFormat, ByteBuffer>(ImageFormat.RGBA, s_imageColorToByteBufferRGBA(img)); 
		case BufferedImage.TYPE_4BYTE_ABGR_PRE: return new Pair<ImageFormat, ByteBuffer>(ImageFormat.RGBA, s_imageColorToByteBufferRGBA(img)); 
		case BufferedImage.TYPE_3BYTE_BGR: return new Pair<ImageFormat, ByteBuffer>(ImageFormat.RGBA, s_imageColorToByteBufferRGBA(img));
		case BufferedImage.TYPE_INT_ARGB: return new Pair<ImageFormat, ByteBuffer>(ImageFormat.RGBA, s_imageColorToByteBufferRGBA(img));
		case BufferedImage.TYPE_INT_RGB: return new Pair<ImageFormat, ByteBuffer>(ImageFormat.RGBA, s_imageColorToByteBufferRGBA(img));
		case BufferedImage.TYPE_CUSTOM: return new Pair<ImageFormat, ByteBuffer>(ImageFormat.RGBA, s_imageColorToByteBufferRGBA(img));
		case BufferedImage.TYPE_BYTE_INDEXED: return new Pair<ImageFormat, ByteBuffer>(ImageFormat.RGBA, s_imageColorToByteBufferRGBA(img));
		case BufferedImage.TYPE_BYTE_BINARY: return new Pair<ImageFormat, ByteBuffer>(ImageFormat.RGBA, s_imageColorToByteBufferRGBA(img));
		default: throw new RuntimeException(s_intFormatToString(fmtInt) + " is not supported!");
		}
	}