Inability to save alpha channel

I’m feeding it this image:
test
And the code gives back complete black.

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);
}

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