Menu

Do canvas, createImageBitmap and sharp premultiply alpha when they resize? A lookup from one cutout PNG
📰

Do canvas, createImageBitmap and sharp premultiply alpha when they resize? A lookup from one cutout PNG

DEV Community: javascript·NullPointerZen·about 8 hours ago
#YnFvfEEV
#devtojavascript#devto#dev#alpha#pixels
Reading 0:00
15s threshold

I wanted a one-line answer to a small question: when I shrink a PNG that has a cut-out edge, which of the browser and Node resize calls quietly mix the colour stored under the transparent pixels into the edge? I answered it with a table built from one image. I am a tool person, not an imaging person, so everything below comes from what the pixels did, not from reading library source.

The test image is a portrait from Wikimedia Commons (CC BY-SA 4.0, by Dmitry Makeev), scaled to 1330×2000 and cut out with ImgIng (图映), a browser tool at https://imging.ai/ that I used on a desktop.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.