• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 444
  • Last Modified:


I am a trainee and I have been assigned a project
which is about image comparison.  it involves reading of gif or jpeg or tiff files.  
As GD is a software which is used for such purposes. We want to develop like this but with many additions
acc to our project.

Can anyone suggest some tutorials for writing C programs for such purposes?

Basically I need to read the image file.

Thanks in advance,
1 Solution
Jpg is easily read from the free jpg library. Its in C as I remember. It can read and write many other types as well, I forget the list. Gif is probably not in the list but most of the others are.  Its well written; I hacked it in about 15 min to read and write raw files (just rgb data, no header, no compression)...

mannoamiAuthor Commented:
Jonnin,thanks for ur response.

i know bout the library. i do have it. but actualy i wanna know that how they r written like what method
should i follow to write such programs in C 4 images.

so basically i want a tutorial for such purpose.
The method is to convert raw pixel data (RGB) into a standard file format that you desire. For some formats this is just adding a header or creating a palette, while for others its very complex. The extension tells you the base type, then a header on the type will tell you the subtype (if any), and the image parameters.  

JPG for example uses discrete cosine transfer to reduce the data into regions that compress well (lots of zeros), lots of math but this algorithm is well known and much posted on the web.  Jpg 2000 uses wavelets to do the same; they get more zeros than dct, but same idea.  Wavelets are the way of the future, but intense computations are needed.
Time space tradeoff strikes again...

I don't know of many free resources here, beyond jpg's free stuff. I can recommend books if you have $$ to spend, and programming/math background to understand them (they are not easy for me to understand, I have a math minor for a reference point)...
Note that signal processing pages/books are often really about image processing!

But what you really need is a list of file formats and what goes where in them. I don't know where to get this (no one location really) ...
You will also need the compression/decompression algorithms used in many of the formats, this is avail on the web for most of them.

Improved Protection from Phishing Attacks

WatchGuard DNSWatch reduces malware infections by detecting and blocking malicious DNS requests, improving your ability to protect employees from phishing attacks. Learn more about our newest service included in Total Security Suite today!


here is a site that I found a while back that might help you. Most of the formats are old, but some really are good. Hope this helps,


It isn't the tutorial you asked for, but if you start working with formats then all this has the compression/decompression info of a lot of formats.

Kent OlsenData Warehouse Architect / DBACommented:
No comment has been added lately, so it's time to clean up this TA.

I will leave a recommendation in the Cleanup topic area that this question is:
Accept guidway's comment as answer

Please leave any comments here within the next seven days.


Kent (Kdo)
EE Cleanup Volunteer
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Tackle projects and never again get stuck behind a technical roadblock.
Join Now