enhance(backend): blurhash生成時、リサイズしてからRawに変換するように (MisskeyIO#832)

This commit is contained in:
あわわわとーにゅ 2024-12-19 05:35:45 +09:00 committed by GitHub
parent b3f73d7312
commit 08a53cdd2c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -457,9 +457,9 @@ export class FileInfoService {
private async getBlurhash(path: string, type: string): Promise<string> {
const sharp = await sharpBmp(path, type);
const { data, info } = await sharp
.raw()
.ensureAlpha()
.resize(64, 64, { fit: 'inside' })
.ensureAlpha()
.raw()
.toBuffer({ resolveWithObject: true });
return encode(new Uint8ClampedArray(data), info.width, info.height, 5, 5);