deno-image is a deno module for resizing images (for now).
import { resize } from "https://deno.land/x/deno_image/mod.ts";
const img = await resize(Deno.readFileSync("./demo/img.jpg"), {
width: 100,
height: 100,
});
Deno.writeFileSync("./demo/result.jpg", img);
Returns a Promise<Uint8Array>
with the resized image.
Type: Uint8Array
An image Uint8Array. Supported formats are jpg
and png
.
Type: Object
Type: number
Desired width of the target image. For landscape images, width
has priority,
for portrait images, height
has priority.
Type: number
Desired height of the target image. For landscape images, width
has priority,
for portrait images, height
has priority.
Type: boolean
Keep aspect ration. Default is true
.
This module uses the following projects with some changes to work with Deno: