Fixed 267U.pre2

This commit is contained in:
2026-07-26 18:25:37 +09:00
parent 50bfaeafdf
commit 317d00a284
1286 changed files with 80222 additions and 1 deletions
@@ -0,0 +1,20 @@
import sharp from "sharp";
/**
* Convert to WebP
* with resize, remove metadata, resolve orientation, stop animation
*/ export async function convertToWebp(path, width, height, quality = 85) {
return convertSharpToWebp(await sharp(path), width, height, quality);
}
export async function convertSharpToWebp(sharp1, width, height, quality = 85) {
const data = await sharp1.resize(width, height, {
fit: "inside",
withoutEnlargement: true
}).rotate().webp({
quality
}).toBuffer();
return {
data,
ext: "webp",
type: "image/webp"
};
}