>>1036705 (OP)
You need more complex methods for lossy codecs, but this will work for a PNG. Each pixel is 24 bits (8 bits each for red, green, blue). If you cleared the low order bit from color, there'd be very little change in your image. This is easy to see when viewing the bytes as numbers from 0 to 255, because you're effectively rounding each color byte down to to the nearest even number. So 149->148, and even numbers remain fixed. On average, only half of colors change at all. Now instead of just 'clearing' the low order bit, you'll use this procedure to store arbitrary data. Need to store 3000 bits? Then you'll use 1000 pixels.