public void overwriteTRNS(byte r, byte g, byte b) {
        if(hasAlphaChannel()) {
            throw new UnsupportedOperationException("image has an alpha channel");
        }
        byte[] pal = this.palette;
        if(pal == null) {
            transPixel = new byte[] { 0, r, 0, g, 0, b };
        } else {
            paletteA = new byte[pal.length/3];
            for(int i=0,j=0 ; i<pal.length ; i+=3,j++) {
                if(pal[i] != r || pal[i+1] != g || pal[i+2] != b) {
                    paletteA[j] = (byte)0xFF;
                }
            }
        }
    }