Creates a new buffer while removing any unnecessary empty bytes. Useful for when wanting to save an image as a specific format.
The buffer to reslice.
The width of the output buffer.
The height of the output buffer.
The resliced buffer.
import { resliceBufferWithPadding } from "@std/webgpu/row-padding";import { assertEquals } from "@std/assert";const input = new Uint8Array([0, 255, 0, 255, 120, 120, 120]);const result = resliceBufferWithPadding(input, 1, 1);assertEquals(result, new Uint8Array([0, 255, 0, 255])); Copy
import { resliceBufferWithPadding } from "@std/webgpu/row-padding";import { assertEquals } from "@std/assert";const input = new Uint8Array([0, 255, 0, 255, 120, 120, 120]);const result = resliceBufferWithPadding(input, 1, 1);assertEquals(result, new Uint8Array([0, 255, 0, 255]));
Creates a new buffer while removing any unnecessary empty bytes. Useful for when wanting to save an image as a specific format.