Menu

What one portrait and one hair sample can and cannot tell you before you change a thumbnail pipeline
📰

What one portrait and one hair sample can and cannot tell you before you change a thumbnail pipeline

DEV Community: javascript·AsyncMonk·about 8 hours ago
#kGc6JmiF
#devtojavascript#devto#dev#alpha#edge
Reading 0:00
15s threshold

Before touching a thumbnail pipeline that shrinks cut-out PNGs, I wanted to know one thing: does it matter whether RGB is premultiplied by alpha before the resize? This post uses two of my three test cut-outs, the portrait and a white dog, and covers what they settled and what they left open.

The cut-outs came from ImgIng https://imging.ai/ in a desktop browser, using its AI cut-out tool and exporting PNG at the input size. The sources are two Wikimedia Commons photos, a portrait (Dmitry Makeev, CC BY-SA 4.0) and a Bichon Frise (TudorTulok, CC BY-SA 4.0), both scaled to a 2000 px long edge. I shrank each result by a factor F and enlarged it back, once per channel and once premultiplied. Everything below is these two images, one Apple M4, one run each.

What the two samples settled

The blur and the dirty edge are two separate problems. The alpha channel came out identical both ways, with a maximum difference of 0, so the softer edge comes from interpolation, which both methods share.…

Continue reading — create a free account

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