Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C Turbo
I have to make a program to read the R,G,B colour of an image. Please tell me the code for reading an image.
Posted 30-Jan-11 18:10pm
Edited 30-Jan-11 21:49pm
v2
Comments
Nithin Sundar at 30-Jan-11 23:33pm
   
We cannot tell you the code. We can only help you if you have problems with your code. Please show some effort and everyone will be happy to help you.
Thaddeus Jones at 31-Jan-11 2:08am
   
What format (e.g. jpeg, png, bitmap) is your image stored in?
Laxmikant_Yadav at 31-Jan-11 6:59am
   
Plz specify the image file format.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

We can't just give you code for this: it will depend on what image type you are trying to read:
.JPG internal format is totally different from .BMP for example.
 
C does not have the high-level routines to read an image file - you have to read the file format and process it yourself.
 
Reading the file is easy:
   FILE *input;
   char get_char;
   input = fopen("myimage.bmp", "rb");
   while((get_char=fgetc(input))!= EOF)
      {
      ...
      }
   fclose(input);
Reads a file a byte at a time.
 
You will need to Google for the file format, and process it accordingly.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

See here[^] for all the Microsoft support libraries for graphics. You may also need to Google for specifics on some graphics structures.
  Permalink  
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 274
1 Sergey Alexandrovich Kryukov 255
2 Shweta N Mishra 216
3 PIEBALDconsult 200
4 BillWoodruff 174
0 OriginalGriff 7,630
1 Sergey Alexandrovich Kryukov 7,022
2 DamithSL 5,586
3 Manas Bhardwaj 4,946
4 Maciej Los 4,525


Advertise | Privacy | Mobile
Web04 | 2.8.1411023.1 | Last Updated 31 Jan 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100