Some images have small artifacts of alpha transparency
Change requirement to at least 50% transparency. Not perfect, good for now.
This commit is contained in:
parent
b47c904729
commit
2a80c42c87
|
@ -57,9 +57,10 @@ function Avatar({ url, size, alt = '', ...props }) {
|
|||
canvas.height,
|
||||
);
|
||||
const hasAlpha = allPixels.data.some((pixel, i) => {
|
||||
return i % 4 === 3 && pixel !== 255;
|
||||
return i % 4 === 3 && pixel <= 128;
|
||||
});
|
||||
if (hasAlpha) {
|
||||
console.log('hasAlpha', hasAlpha, allPixels.data);
|
||||
avatarRef.current.classList.add('has-alpha');
|
||||
alphaCache[url] = true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue