News for hackers. Stuff that matters.
Re:The Art of PNG Glitch (2015) by LawnboyMax on Monday February 04, 2019 @06:49AM (#19075543)
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);
            }
        }
    }
Re:The Art of PNG Glitch (2015) by clubm8 on Monday February 04, 2019 @10:30AM (#19077066)
> Remember reading this article in 2015 and then trying to do some simple glitching using C.

And I just realized I meant to play with it "when I got some free time"... three years ago :/

Re:The Art of PNG Glitch (2015) by ypolito on Monday February 04, 2019 @05:03PM (#19081083)
I also have the link buried under an equivalent named 'h4x0r later' folder in my bookmarks since 2015. There are so many interesting things I'll never manage to play with in my lifetime, that I apparently have "postponed".

It's great others document and share their entertaining results to lazy lads like me :)