gluestick/src/image.ts

8 lines
218 B
TypeScript
Raw Normal View History

2023-04-26 21:21:28 -04:00
import sharp from "sharp";
export async function ensureJpg(avatar: Buffer) {
const img = await sharp(avatar).toFormat("jpeg").resize(512, 512);
const buf = await img.toBuffer();
return buf.toString("base64");
}