将JPEG图像转换为黑白

时间:2022-01-16 16:51:58

Is there any specific way to convert jpeg images to black and white using C? I converted a .bmp image to black and white using C by simply extracting the headers (which in .bmp file is 54 bytes in length) and converting the RGB to the respective gray level using the formula. But how to do that in jpeg file?

使用C语言将jpeg图像转换为黑白图像有什么特别的方法吗?我使用C将.bmp图像转换为黑色和白色,方法是简单地提取头部(在.bmp文件中是54字节的长度),然后使用公式将RGB转换为相应的灰色级别。但是如何在jpeg文件中做到这一点呢?

1 个解决方案

#1


0  

If you can afford to link a library, I highly recommend OpenCV for this task: http://opencv.willowgarage.com/

如果您负担得起链接一个库的费用,我强烈推荐OpenCV完成这个任务:http://opencv.willowgarage.com/

#1


0  

If you can afford to link a library, I highly recommend OpenCV for this task: http://opencv.willowgarage.com/

如果您负担得起链接一个库的费用,我强烈推荐OpenCV完成这个任务:http://opencv.willowgarage.com/