Remember reading this article in 2015 and then trying to do some simple glitching using C.
Simply inserting an additional NULL for a specific RGB range will cause all channels written after it to become misaligned and will create quite an interesting output image (similar to figure B.14 in the article). I.e. an R component will be written into G's place, G will be written into B's place etc..
It goes along these lines:
for (int i = 0; i < imgHeight; i++) {
for (int j = 0; j < imgWidth; j++) {
RGBTRIPLE triple;
fread(&triple, sizeof(RGBTRIPLE), 1, inptr);
if (triple.rgbtRed == 0xa4 && triple.rgbtGreen == 0x90 && triple.rgbtBlue < 0x77) {
fwrite(&triple, 4, 1, outptr); // an additional NULL is written to ouput
} else {
fwrite(&triple, 3, 1, outptr);
}
}
}