S
Shahnaz
Can anybody help me?
How to open picture file i.e.bmp of windows through C language?
Many Thanks,
Shahnaz
How to open picture file i.e.bmp of windows through C language?
Many Thanks,
Shahnaz
Shahnaz said:Can anybody help me?
How to open picture file i.e.bmp of windows through C language?
Shahnaz said:How to open picture file i.e.bmp of windows through C language?
Shahnaz said:Can anybody help me?
How to open picture file i.e.bmp of windows through C language?
Many Thanks,
Shahnaz
Romulo Carneiro said:First you have to learn more about bmp format,
about header ...
Second, this code example only open a picture and read first part of
header..
#include<stdio.h>
int main(void){
FILE *fp;
FILE *sai;
char ch;
int i,j,k;
unsigned short int tipo;
/*---------------- Cabe‡alho da Imagem----------------- */
struct imagem {
unsigned short int type;
unsigned int size;
unsigned short int reserved1,reserved2;
unsigned int offset;
} header;
/*-----------------Cabe‡alho de mapa de bits------------*/
struct Bmp2 {
unsigned int size; /* Header size in bytes */
int width,height; /* Width and height of image */
unsigned short int planes; /* Number of colour planes */
unsigned short int bits; /* Bits per pixel */
unsigned int compression; /* Compression type */
unsigned int imagesize; /* Image size in bytes */
int xresolution,yresolution; /* Pixels per meter */
unsigned int ncolours; /* Number of colours */
unsigned int importantcolours; /* Important colours */
} infoheader ;
struct imagem tmp;
/*--------------------- lendo cabeçalho imagem--------------*/
clrscr();
if ((fp=fopen("synapsis.bmp", "rb" ))==NULL){
printf("nÆo , possivel abrir o arquivo");
exit(1);
}
while (ch != EOF){
ch = getc(fp);
printf("%x",ch);
}
if (fread (&header, sizeof(struct imagem),1,fp) < 1){
Romulo Carneiro said:Answer you last question about types...this types are used in bitmap
image.
Answer you last question about types...this types are used in bitmap
image.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.