Click here to Skip to main content
12,692,778 members (35,349 online)
Rate this:
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
Updated 2-Dec-16 19:12pm
Nithin Sundar 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 31-Jan-11 2:08am
What format (e.g. jpeg, png, bitmap) is your image stored in?
Laxmikant_Yadav 31-Jan-11 6:59am
Plz specify the image file format.
Rate this: bad
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)
Reads a file a byte at a time.

You will need to Google for the file format, and process it accordingly.
Rate this: bad
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.

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170118.1 | Last Updated 3 Dec 2016
Copyright © CodeProject, 1999-2017
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