1. Hi Guest
    We are running a survey about laptop service in India, and we'd love your inputs. Please help us improve the quality of laptop servicing, and if you've had any bad experiences, now is the time to be heard.
    Take the survey

jpeg & bmp format viewer

Discussion in 'Software Q&A' started by faraz_majidkhan, Mar 13, 2006.

Thread Status:
Not open for further replies.
  1. faraz_majidkhan

    faraz_majidkhan New Member

    Joined:
    Dec 16, 2005
    Messages:
    25
    Likes Received:
    0
    Trophy Points:
    0
    Can Anyone tell me about a software that can show me the jpeg & bmp format files in text form like header info, pixels as RGB values(232,122,63),etc.
     
  2. OP
    OP
    faraz_majidkhan

    faraz_majidkhan New Member

    Joined:
    Dec 16, 2005
    Messages:
    25
    Likes Received:
    0
    Trophy Points:
    0
    Also can someone tell me how to display images of bmp & jpeg formats using Turboc & <graphic.h>.
     
  3. Gaurav

    Gaurav Member

    Joined:
    Mar 25, 2004
    Messages:
    483
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Delhi/NCR
  4. aadipa

    aadipa New Member

    Joined:
    Feb 12, 2004
    Messages:
    997
    Likes Received:
    2
    Trophy Points:
    0
    Location:
    Palghar, Mumbai
    For 1st, try IrfanView and for Q2, TurboC, let me search the code that I wrote..

    The problem is that you cannot go more that VGA (640x480 in 16 colors) or SVGA (320x240 in 256 colors) in DOS version of TC.
     
  5. aadipa

    aadipa New Member

    Joined:
    Feb 12, 2004
    Messages:
    997
    Likes Received:
    2
    Trophy Points:
    0
    Location:
    Palghar, Mumbai
    You can download BMP format specifications from here

    http://www.aadipa.be/share/bmpfrmat.doc
    Alternate Link: http://rapidshare.de/files/16701265/bmpfrmat.doc.html

    Also, I found out my code, but it is incomplete in TC (I lost completed copy in HDD crash few years ago :( ), but I opened/edited BMP images in VB and VC++, it is simple once you know format of BMP file.

    Here are C sniplets of my code which may help you.
    Code:
    #define BYTE unsigned char
    #define WORD unsigned int
    #define DWORD unsigned long
    
    Code:
    /*STRUCTURE OF BITMAP FILE HEADER*/
    
    /* FILE HEADER */
    struct fileheader {
    	char bftype[2];
    	DWORD bfsize;
    	WORD bfreserved1;
    	WORD bfreserved2;
    	DWORD bfoffbits;
    	};
    
    
    /* IMAGE INFORMATION HEADER */
    struct bitmapinfoheader {
    	DWORD bisize;
    	DWORD biwidth;
    	DWORD biheight;
    	WORD biplanes;
    	WORD bibitcount;
    	DWORD bicompression;
    	DWORD bisizeimage;
    	DWORD bixpelspermeter;
    	DWORD biypelspermeter;
    	DWORD biclrused;
    	DWORD biclrimportant;
    	};
    
    
    /* PALETTE HEADER*/
    struct colortable {
    	BYTE rgbblue;
    	BYTE rgbgreen;
    	BYTE rgbred;
    	BYTE rgbreserved;
    	};
    
    Code:
    void displayBMPInfo(FILE *fp) {
    
    	unsigned long size;
    
    	struct fileheader header;
    	struct bitmapinfoheader info;
    	//struct colortable table;
    	//struct palettetype pal;
    
    	/*TO CHECK THE EXISTENCE OF FILE */
    	if(fp==NULL) {
    		return;
    		}
    
    	fseek(fp, 0, SEEK_END);
    	size = ftell(fp);
    	fseek(fp, 0, SEEK_SET);
    	fread(&header, 1, sizeof(header), fp);
    	clrscr();
    
    	/* TO CHECK THE SIGNATURE OF THE BITMAP FILE "BM" */
    	if(header.bftype[0]!='B' || header.bftype[1]!='M') {
    		 return;
    		 }
    
    	fread(&info,1,sizeof(info),fp);
    	//if required the following BMP header informations can be displayed
    	printf("\n\t\t\tBITMAP FILE HEADER");
    	printf("\nSIZE= %d", size);
    	printf("\nBMPFILE's SIGNATURE= %c",header.bftype[0]);
    	printf("%c",header.bftype[1]);
    	printf("\nSIZE OF BITMAPFILE= %ld",header.bfsize);
    	printf("\nRESERVED1 = %d",header.bfreserved1);
    	printf("\nRESERVED2 = %d",header.bfreserved2);
    	printf("\nOFFSET TO THE IMAGE DATA = %ld",header.bfoffbits);
    	printf("\n\n\t\t\tBITMAP INFO HEADER");
    	printf("\n\nBITMAPINFO HEADER SIZE\t\t\t= %ld",info.bisize);
    	printf("\nIMAGE WIDTH\t\t\t\t= %ld",info.biwidth);
    	printf("\nIMAGE HEIGHT\t\t\t\t= %ld",info.biheight);
    	printf("\nNo. OF PLANES IN THE IMAGE\t\t= %d (usually '1')",info.biplanes);
    	printf("\nBITS REQUIRED TO REPRESENT A PIXEL\t= %d",info.bibitcount);
    	printf("\nCOMPRESSION BIT\t\t\t\t= %ld (0 -if no Compression used)",info.bicompression);
    	printf("\nBYTES REQUIRED FOR IMAGE DATA ALONE\t= %ld",info.bisizeimage);
    	printf("\nbixpelspermeter\t\t\t\t= %ld",info.bixpelspermeter);
    	printf("\nbiypelspermeter\t\t\t\t= %ld",info.biypelspermeter);
    	printf("\nNo. OF COLORS USED\t\t\t= %ld",info.biclrused);
    	printf("\nCOLOR IMPORTANT\t\t\t\t= %ld",info.biclrimportant);
    	}
     
  6. Andyiz

    Andyiz New Member

    Joined:
    Sep 25, 2005
    Messages:
    173
    Likes Received:
    2
    Trophy Points:
    0
    Location:
    Mumbai
    Reply

    Dear friend,
    i appreciatate ur efforts towards helping me
    Just for ur info i had completed reading the file in C:
    My problem is that i will have to create the MINI project IN VB/VC which should satisfy the follwing:
    1> Create, save BMP files,
    2>Open close Bmp files
    3>Editing file
    4>adding basic shapes like circle, rectangle
    5>adding text to it


    This project will not help my cause as its just to be completed and given
    with no gain for me whatsoever
    So i wanted readymade codes for it

    I would rather spend time in working on my major project FACE RECOGNITION

    Can u help????????
    Or can u suggest me some websites where i am likely to get the codes??
     
Thread Status:
Not open for further replies.

Share This Page