Skip to main content
Go to Latest
function resliceBufferWithPadding
import { resliceBufferWithPadding } from "https://deno.land/std@0.223.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.223.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