Deplane! Deplane! (Or: RGBRGBRGB => RRRGGGBBB?)
C

only shuffle, not print

lenght in bytes, not pixels

plane: 0,1,2 for R,G,B

not checked!

void deplane(unsigned char *data, int length, int plane) {
    unsigned char *t = data;
    unsigned char *s = data + plane;
    unsigned char p;
    while (s &lt; data + length) {
        p = *s; *s = *t; *t = p;
        t++; s += 3;
    }
    // now plane start at data
    while (t &gt; data) {
        s -= 3; t--;
        p = *s; *s = *t; *t = p;
    }
    // back to original
}