Skip to main content
Deno 2 is finally here 🎉️
Learn more
Go to Latest
The Standard Library has been moved to JSR. See the blog post for details.
function resliceBufferWithPadding
import { resliceBufferWithPadding } from "https://deno.land/std@0.221.0/webgpu/row_padding.ts";

Creates a new buffer while removing any unnecessary empty bytes. Useful for when wanting to save an image as a specific format.

Examples

Example 1

import { resliceBufferWithPadding } from "https://deno.land/std@0.221.0/webgpu/row_padding.ts";

const input = new Uint8Array([0, 255, 0, 255, 120, 120, 120]);
resliceBufferWithPadding(input, 1, 1); // Uint8Array(4) [ 0, 255, 0, 255 ]

Parameters

buffer: Uint8Array
width: number
height: number

Returns

Uint8Array