使用C读取图像文件的程序 [英] program for reading a image file using C

查看:113
本文介绍了使用C读取图像文件的程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有人,

我需要C程序将其转换为JPG格式的图像,并且已经将其转换为未压缩的图像,请帮我改成相同的图像.

Dear All,

I need C program to a JPG formated image, and i have convert it to uncompressed image, please help me to the same.

推荐答案

我已经读过创建jpeg编码器/解码器大约需要花费1个人年的时间.

必须使用C还是可以使用C ++?

GdiPlus(C ++)允许您在项目中添加/添加少量代码即可打开/保存文件.自XP以来,这是Windows的一部分. (gdiplus.h gdiplus.lib)

步骤:
  • 创建gdiPlus :: Bitmap,将其加载到图像文件中
  • 从此位图创建HBITMAP
  • 在此HBITMAP上获取GetDibBits
  • 清洁结果,从每条扫描线的末尾删除填充字节(如果存在).
I''ve read that there is about 1 man-year''s worth of work to create a jpeg encoder/decoder.

Must you use C, or can you use C++?

GdiPlus(C++) will allow you to open/save files with a small addition of code to your project. This is a included part of Windows since XP. (gdiplus.h gdiplus.lib)

Steps:
  • Create gdiPlus::Bitmap, load it with your image file
  • Create a HBITMAP from this bitmap
  • GetDibBits on this HBITMAP
  • Clean-up result, removing padding bytes (if present) from end of each scan-line.


CodeProject上有一个出色的库,可让您读取JPEG文件并将其转换成几乎所有内容.此链接

CxImage

会带你到那里.不过,它是一个C ++库.如果您需要纯C代码,则可以尝试提取基本部分并将其反向转换为C.

希望有帮助.
There is an excellent library here on CodeProject that lets you read JPEG files and convert it into almost anything. This link

CxImage

will get you there. It is a C++ library, though. If you need pure C code, you could try to extract the essential parts and back-convert them to C.

Hope that helps.


这篇关于使用C读取图像文件的程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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