dao - if you have read the image from file (as a bmp or jpg) using imread, then you can use fopen and fwrite to write the data to a binary file. For example,
myImage = imread('someImage.jpg');
fid = fopen('myBin.bin','w+');
if fid>0
fwrite(fid,myImage,'uint8');
fclose(fid);
end
In the above, we read in some image and open a file for writing (using w+ to indicate that we wish to open or create a new file for writing). It is assumed that the data type for the image is uint8 so we use that in our precision field of the fwrite function.