I suppose the smallest unit you can read/write is a byte via fread / fwrite and then you have to take care of the headers describing the image metadata. So I suggest to use the imread to get the image in Matlab. If you need to access single bits of pixels (or bytes), eg for forming a binary string, you can do that for example by invoking: