By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,006 Members | 1,154 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,006 IT Pros & Developers. It's quick & easy.

help with opening image file

P: n/a
hi all !!
i need help in opening an image file (bmp)
and printing it to the screen.

thanks

Dec 23 '06 #1
Share this Question
Share on Google+
5 Replies


P: n/a
In article <11**********************@f1g2000cwa.googlegroups. com>,
HA*****@gmail.com says...
hi all !!
i need help in opening an image file (bmp)
and printing it to the screen.

thanks
Use fopen and FILE pointer to open the file. The .bmp file starts with BM
in the first two bytes. While reading the file, if the BM string is first
2 bytes then print the file in the screen. If not then throw a error.
Take care while doing the file operations and memory allocations. Hope
this helps.
Dec 23 '06 #2

P: n/a
albo said:
hi all !!
i need help in opening an image file (bmp)
That bit's easy enough. The bitmap format is relatively well-documented and
reasonably simple. You can find out about it in, say, "Programming
Windows", 5th edition, by Charles Petzold, or you could try something like
http://www.wotsit.org/

So it's literally a question of opening the file using fopen, reading the
various bits of header information, then loading and storing the bitmap
information in some suitable data structure (I use an array of arrays of
unsigned long, but that's not the only possible choice). Don't forget that
bitmaps are sometimes (often, usually) stored the wrong way up.
and printing it to the screen.
That's still pretty easy, but the exact details will depend on your
implementation's graphics library provisions. Consult a newsgroup that
deals with your implementation.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.
Dec 23 '06 #3

P: n/a
thanks a lot for the help !!

Dec 24 '06 #4

P: n/a

"Richard Heathfield" <rj*@see.sig.invalidwrote in message
news:P6*********************@bt.com...
albo said:
>hi all !!
i need help in opening an image file (bmp)

That bit's easy enough. The bitmap format is relatively well-documented
and
reasonably simple. You can find out about it in, say, "Programming
Windows", 5th edition, by Charles Petzold, or you could try something like
http://www.wotsit.org/

So it's literally a question of opening the file using fopen, reading the
various bits of header information, then loading and storing the bitmap
information in some suitable data structure (I use an array of arrays of
unsigned long, but that's not the only possible choice). Don't forget that
bitmaps are sometimes (often, usually) stored the wrong way up.
>and printing it to the screen.

That's still pretty easy, but the exact details will depend on your
implementation's graphics library provisions. Consult a newsgroup that
deals with your implementation.
Why is't there a loader available on the net?
After all, one person needs to write a portable load routine once, and if
he's done a competent job no one need ever worry about the details again.
--
www.personal.leeds.ac.uk/~bgy1mm
freeware games to download.
Dec 25 '06 #5

P: n/a
"Malcolm" <re*******@btinternet.comwrote:
"Richard Heathfield" <rj*@see.sig.invalidwrote in message
albo said:
i need help in opening an image file (bmp)
That bit's easy enough. The bitmap format is relatively well-documented
and reasonably simple. You can find out about it in, say, "Programming
Windows", 5th edition, by Charles Petzold, or you could try something like
http://www.wotsit.org/
Why is't there a loader available on the net?
Who says there isn't? Do a websearch.
After all, one person needs to write a portable load routine once, and if
he's done a competent job no one need ever worry about the details again.
Hah. Not much experience with M$ shifting specs, have you?

Richard
Dec 27 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.