🍋
Menu
Image

Alpha Channel

Alpha Channel (Transparency Mask)

An alpha channel stores transparency information for each pixel in an image, with values ranging from fully transparent to fully opaque. It is the fourth channel in RGBA color, enabling smooth blending of images over backgrounds.

التفاصيل التقنية

Alpha values are typically stored as 8-bit (0-255) or floating point (0.0-1.0) per pixel. Pre-multiplied alpha multiplies color values by opacity for faster compositing, while straight alpha stores them independently.

مثال

```javascript
// Convert RGB to HSL
function rgbToHsl(r, g, b) {
  r /= 255; g /= 255; b /= 255;
  const max = Math.max(r, g, b), min = Math.min(r, g, b);
  const l = (max + min) / 2;
  let h = 0, s = 0;
  if (max !== min) {
    const d = max - min;
    s = l > 0.5 ? d/(2-max-min) : d/(max+min);
  }
  return [h, s, l];
}
```

أدوات ذات صلة

مصطلحات ذات صلة