I am new to image processing and can u please help me to convert a GIF image into binary using C programming.

Recommended Answers

All 8 Replies

No sense.
GIF is binary.

Sorry.Im not clear with your answer.Can you explain that..Because what I thought is a binary image is a digital image that has only two possible values for each pixel. Typically the two colors used for a binary image are black and white though any two colors can be used.

But in GIF the format supports up to 8 bits per pixel, allowing a single image to reference a palette of up to 256 distinct colors.

Explain what you mean by "GIF image into binary". I'm assuming you mean to get an actual array of pixels instead of having them in a compressed format, but the question seems vague.

Marco93, if you want to play it that way, your post has no sense. GIF is an image compression format which handles a maximum of 8 bits per pixel and allows animation. Simply saying "GIF is binary" isn't helping, as you will find that pretty much anything on a computer breaks down to binary.

edit: I should really check for previous posts before I post mine.

Seems you are right, I had never heard of it in that way. [link]

Well, the first thing you have to do is read and uncompress the GIF image before you can change it to a binary image. Once you have the pixels in an array, you check each pixel with a threshold (127 I would assume) so if the pixel has a value higher than the threshold, it pixel would be 1, if it's lower, then it would be 0.

Both cases require reading and writing to bitmaps, so it would probably be easiest for you to use a bitmap library on the net.

Thanks for your reply...it was almost clear...

what my problem is ....i got a camera with USB interface.so i need to grab image and to do some image processing...do you have any resources that helps me...i need to to do it in C programming

a camera will not natively store an image as a GIF. it will be a JPEG or a TIFF. all of these formats can be generically referred to as "binary".

your mission, if you choose to accept it, will be to understand the format (JPEG or TIFF) that your camera stores pictures as, and learn to decode it, before you can then manipulate it.

Or get image processing software like
Photoshop
Paint Shop Pro
Gimp

if you want to get the actual array of image pixel, you must use a certain algorithm. such as vector quantization algorithm.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.