I love graphics programming through C & C++, I have worked a lot, but i am still very far away from bmp files, Can any one tell me how i can access bmp file through C, C++.
Thanks in advance :rolleyes:

Recommended Answers

If you just want to view images, there is a simple C code snippet on DaniWeb:
[url]http://www.daniweb.com/code/snippet86.html[/url]

It's called "Displaying a JPEG image using Windows GUI", it will also display BMP and other images.

Jump to Post

All 3 Replies

Re: I want bmp files through C/C++, Help 80 80

I love graphics programming through C & C++, I have worked a lot, but i am still very far away from bmp files, Can any one tell me how i can access bmp file through C, C++.
Thanks in advance :rolleyes:

First you have to know the format of a bitmap file. Read this: http://www.fortunecity.com/skyscraper/windows/364/bmpffrmt.html

Re: I want bmp files through C/C++, Help 80 80

If you just want to view images, there is a simple C code snippet on DaniWeb:
http://www.daniweb.com/code/snippet86.html

It's called "Displaying a JPEG image using Windows GUI", it will also display BMP and other images.

Re: I want bmp files through C/C++, Help 80 80

one easy way to do it is,

declare image and header array;

unsigned char Header[0x435],image[256][256];

and to read image;

fread(Header,1,0x435,fp);	// copy image header to Header array
		fseek(fp,0x436,SEEK_SET);	// Move file pointer to start of image data
		fread(image,1,256*256,fp);	// read image data and copy to ImageIn1[][] array

		fclose(fp);
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.