# Inability to save alpha channel

**URL:** https://discourse.processing.org/t/inability-to-save-alpha-channel/19448
**Category:** Coding Questions
**Created:** [April 6, 2020, 12:20am UTC](https://discourse.processing.org/t/inability-to-save-alpha-channel/19448 "2020-04-06T00:20:39Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Odermonicon](https://avatars.discourse-cdn.com/v4/letter/o/96bed5/32.png) [@Odermonicon](https://discourse.processing.org/u/Odermonicon)
#### Post date: [April 6, 2020, 12:20am UTC](https://discourse.processing.org/t/inability-to-save-alpha-channel/19448/1 "2020-04-06T00:20:40Z")

</div>

I’m feeding it this image:  
 ![test](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/f/f64efbe6a9127a848d9691547933e406e6218f53.jpeg)  
And the code gives back complete black.

```auto
PImage IMG;
void setup() {
  background(128);
  size(500, 500);
  IMG = loadImage("test.png");
  colorMode(HSB, 255);
  IMG.loadPixels();
  for (int i = 0; i < IMG.pixels.length; i++) {
    color pixel = IMG.pixels[i];
    pixel = color(hue(pixel), saturation(pixel), 0, brightness(pixel));
    IMG.pixels[i] = pixel;
    //println(alpha(pixel));
  }
  IMG.updatePixels();
  IMG.save("tset.png");
}

void draw() {
  background(#FFFF00);
  image(IMG,0,0);
}

```

---

<div class="post-metadata">

### Author: ![SomeOne](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/someone/32/8639_2.png) [@SomeOne](https://discourse.processing.org/u/SomeOne)
#### Post date: [April 6, 2020, 6:11am UTC](https://discourse.processing.org/t/inability-to-save-alpha-channel/19448/2 "2020-04-06T06:11:22Z")

</div>

> [@Odermonicon](#):
>
> pixel = color(hue(pixel), saturation(pixel), 0, brightness(pixel));

Channel order is HSBA. You are setting third channel (brightness) to zero and it makes all pixels black.
