如何在不使用任何库的情况下将BMP转换为TIFF图像 [英] How can I convert a BMP to TIFF image without using any library

查看:157
本文介绍了如何在不使用任何库的情况下将BMP转换为TIFF图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为纯C开发硬件设备的解决方案。



我需要压缩图像BMP并考虑使用TIFF格式(图像是单色的,问题是如何在不使用任何外部库的情况下从BMP转换为TIFF。



任何人都可以提供帮助



谢谢



Miguel



我尝试了什么:



Google搜索没有任何成功:-)



尝试一些带有一些结果的论坛

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

Thanks

Miguel

What I have tried:

Google search without any success :-)

Try some forums with some result

推荐答案

如果您不想使用库,则必须自己编写代码。您可以查看开源库的来源,如 ImageMagick:转换,编辑或撰写位图图像 [ ^ ]或者它的派生GraphicsMagick图像处理系统 [ ^ ]作为起点。最简单的解决方案是在源许可证允许的情况下重用现有代码。因为 ImageMagick 使用Apache 2许可证,所以它是一个很好的候选者。





来自你的问题似乎使用TIFF只是一种选择。因此,您也可以使用标准压缩方法压缩位图。然后你只需要实现压缩方法(除了可选的BMP文件映像创建)。但是,这要求图像文件必须稍后解压缩。

[/ EDIT]
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.
[/EDIT]


我先来看看这里



如何在C#&#8211中将位图转换为1bpp单色TIFF;知识库 [ ^ ]
I'd start with a look here

How to convert a bitmap into a 1bpp monochrome TIFF in C# – Knowledgebase[^]


引用:

问题是如何在不使用任何外部库的情况下从BMP转换为TIFF。

the problem is how to convert from BMP to TIFF without using any external libraries.

简单!

你只需制作一个替换你不想使用的库的程序!

你必须:

- 定义一个中性格式,适合您的需求。通常是包含图片位图版本的数组。

- 将BMP解码器写入中性格式。可能涉及一些减压。必须通过查找格式定义或在源代码中查找解码器来获取线索来搜索BMP格式详细信息。

- 从中​​性格式编写TIFF编码器。涉及压缩。必须找到与BMP相同的信息。

- 需要第三方工具以确保结果正常。

- 需要大量工作。

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.


这篇关于如何在不使用任何库的情况下将BMP转换为TIFF图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆