static final byte[] convertPad(byte[] data, int width, int height,
			int depth, int pad, int newPad) {
		if (pad == newPad)
			return data;
		int stride = (width * depth + 7) / 8;
		int bpl = (stride + (pad - 1)) / pad * pad;
		int newBpl = (stride + (newPad - 1)) / newPad * newPad;
		byte[] newData = new byte[height * newBpl];
		int srcIndex = 0, destIndex = 0;
		for (int y = 0; y < height; y++) {
			System.arraycopy(data, srcIndex, newData, destIndex, stride);
			srcIndex += bpl;
			destIndex += newBpl;
		}
		return newData;
	}