You are here:

C/c graphics

Advertisement


Question
sir
i want  a program in c which, take our photo from our storage drive like 'd' drive. and display in output screen.and give code for that.

Answer
Sir:

Thank you for your question. Although I don't have experience solving this particular problem, I will try to direct you to some resources.

First, I'd like to say that this is not a C question in particular, and you might find it easier to solve your problem with some other technology like Java or VisualBasic because those products have extensive libraries and graphical controls to do just what you are asking.

However, I'll do my best to get you started in C.

I will assume you are using the Microsoft Windows operating system and have access to some version of Visual Studio. Microsoft has a free version of Visual Studio at http://www.microsoft.com/express/download/ . If you are using Linux, or some other system, the methods to create programs and display windows would be different.

No matter what system you're using, to display pictures, you need to decode the jpeg format. Microsoft Windows Visual C++ has library functions to do that so you don't have to worry about it.

You can see a sample program, with source code, at
http://support.microsoft.com/kb/218972
That article has a download called loadpic.exe which is a visual studio project. You download the file, and run it. It will extract a visual studio project and source code to you hard drive. You can then open the visual studio project, build it, and run the program.

Another sample, based on the Microsoft article can be found at http://www.codeproject.com/KB/graphics/render.aspx .

Now, if you are interested in going one level deeper and actually decoding the jpeg format, you can get libraries to do that at http://gnuwin32.sourceforge.net/packages/jpeg.htm . However, you'd need to know even more about programming your system to get the graphics displayed in a bitmap.

I hope that gets you started. Feel free to follow up if you need to.

Best regards
Zlatko

C

All Answers


Answers by Expert:


Ask Experts

Volunteer


Zlatko

Expertise

No longer taking questions.

Experience

No longer taking questions.

Education/Credentials
No longer taking questions.

©2012 About.com, a part of The New York Times Company. All rights reserved.