Click here to Skip to main content
15,746,107 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, I am developing a solution for a hardware device in pure C.

I need to compress an image BMP and thought in using the TIFF format (the image is monochromatic), the problem is how to convert from BMP to TIFF without using any external libraries.

Anyone can help



What I have tried:

Google search without any success :-)

Try some forums with some result
Updated 14-Apr-23 6:54am

If you don't want to use a library you have to write the code yourself. You may have a look at the sources of open source libraries like ImageMagick: Convert, Edit, Or Compose Bitmap Images[^] or it's derivate GraphicsMagick Image Processing System[^] as starting point. The simplest solution would be re-using existing code when the source license allows that. Because ImageMagick uses the Apache 2 license, it is a good candidate.

From your questions it seems that using TIFF is only an option. So you might also just compress the bitmap using a standard compression method. Then you only have to implement the compression method (besides the optional creation of a BMP file image). However, this requires that the image file must be later decrompressed.
Share this answer
Share this answer
the problem is how to convert from BMP to TIFF without using any external libraries.
Simple !
You just have to make a program that is replacing the library you don't want to use !
You have to:
- define a neutral format that suit your needs. Usually an array containing a bitmap version of the picture.
- Write a BMP decoder to your neutral format. Can involve some decompression. Have to search for BMP format details either by finding the format definition or by finding a decoder in source code to get clues.
- Write a TIFF encoder from your neutral format. Involve compression. Have to find same information as for BMP.
- Need third party tools to ensure that the result is ok.
- Need to lot of work.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

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