• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 442
  • 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.

Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.


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

Get 10% Off Your First Squarespace Website

Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to Squarespace.com and use offer code ‘EXPERTS’ to get 10% off your first purchase.

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