-
Notifications
You must be signed in to change notification settings - Fork 83
Open
Description
I'm using sharp to resize the images for use with thumbhash with user uploaded images like so
const { data, info } = await sharp(image)
.resize({ width: 100, height: 100, fit: "inside" })
.ensureAlpha()
.raw()
.toBuffer({ resolveWithObject: true });
console.log(info)
/*
{
format: 'raw',
width: 100,
height: 100,
channels: 4,
depth: 'uchar',
premultiplied: true,
size: 40000
}
*/
const thumbhash = rgbaToThumbHash(info.width, info.height, data);I noticed that sharp is outputting premultiplied images depending on the import format (PNG always seems to be premultiplied, webp isn't, etc.). I can't figure out a way to disable premultiplication or unpremultiply using sharp, so I was wondering if there was a way to handle premultiplied images within rgbaToThumbHash or process it myself before passing it to rgbaToThumbHash?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels