List,
I have been trying to search on reading an image file via C. I haven't been able to find code without libraries. However, being aware of the 'binary' mode in Windows (Turbo C++), I had read it using fopen, fread and fseek to read the header and then the contents. However, this reading was done reading individual bytes and not reading it using structures.
Apologies, ahead, because, I suspect I may be using wrong 'terms' or may have some incorrect information. (Correct me, thanks)
For example, a .bmp (grayscale image) file has first 54 bytes as header (IIRC, correct me, if I'm wrong). Somewhere within that, there's the height and width of the image.
Following the 54 bytes are the pieces of image data containing integers between 0 - 255 representing grayscale colors.
This seemed to work in Windows because I could see the results. Now, I do know that there are libraries that make this task easier in various distributions of Linux but the purpose (or requirements, If I may say) here it to read it in the same way as it was done in Windows.
Though I also do see 'b' mode in the manual page of 'man fread', but I'm doubtful about the results. If anyone has tried to read an image file or has good sample code that I can lookup, would like to have links to it. Alternately, if someone can put in a few details regarding this in a little more 'easy-to-understand' way, that would be helpful.
Thanks in advance for any help.
-- Roshan Baladhanvi