Click here to Skip to main content
15,039,214 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi all,
Before I start writing my question I want to make it clear that this is my first post and I am really newbie in programming. I just learned C (i.e string manipulation, array n all). I use very old version of turbo C compiler ( blue screen:P now I know its antique these dayz) (coz my friend told me that its easy to use and with C you can do anything which other compiler can do). I have to admit it was really easy to understand.

Now I want to make a program which takes image as an input n also give image as an input with some editing like zoom in/out. I dont know where to start.

So my question is: Is it possible with C n this compiler to input image and store its pixel in array coz all libraries ( like magick++, opencv, CImg) I tried gives error during compilation, so I think they r not compatible with this compiler.

After some more google search I came around this code:
FILE *fp;
unsigned char *bufferImmagine;
bufferImmagine=new unsigned char [dimX*dimY*3];
fread (bufferImmagine,dimX*dimY*3,1,fp);

but I can't understand anything in it. So please help here also.

and my last question is:
I want to learn graphic handling and c++ now. So please suggest me a good way and a good compiler. whether I stick with this turbo c++, or use new version of borland or VC++??
n also tell me what is the difference between these compilers??

thanks n regard
Updated 19-Sep-11 23:11pm

You are approaching this problem from the wrong starting point. You say that you do not understand the code snippet posted above, which is a fairly simple piece of C code. You would be better spending some time learning the basics of file handling and Windows programming before moving on to graphics. As to which compiler to use I would suggest Microsoft's C++ compiler which you can get free here[^].
deepak212 20-Sep-11 5:50am
thanks richard...
but what i didnt understand in that code is:
it is allocation (dimx*dimy*3) bytes of space to bufferimmagine....
then i m opening image in that...
but to do that i should know dimension of image first....
if i want to input images of different sizes then how can i do that???
Richard MacCutchan 20-Sep-11 5:58am
You cannot do it this way. Images are not simple files of X x Y bytes. They have specific control information around them to show how the raw bytes are transformed into colours on the screen, and each file type has a different format. Try searching Google for BMP, JPEG, GIF, etc. to get some more information.
As I said above you really need to have a good understanding of file handling before you can approach this more advanced subject.
deepak212 21-Sep-11 16:31pm
ok thanks richard...
i think so better way for me is to write code in vs.
deepak212 21-Sep-11 16:31pm
and use some libraries.
Richard MacCutchan 22-Sep-11 3:19am
Here are two article links on CodeProject that you should find useful:
Bitmap Basics and Loading JPEG and PNG images.
you can not directly include the image in the c++.
and the last ans of your question is that you use the turbo c++ for the graphic and for leaning the graphic you can prefer the book graphic in c.
deepak212 20-Sep-11 5:02am
thanks for your reply.... but my question is then how can I input image in C or C++. and store its pixel values in 2Darray for manipulation?

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

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900