图片解码算法

wwmwenzhu 2009-04-30 08:51:53
文件格式包括bmp、jpg、png、gif图片,如何解码?下述是文件格式说明
http://www.oldchild.net/jsjsj/asm/dmtjc/dmtjc6.htm
希望提供算法代码,也可推荐书籍网址等。还可加分!!!!!
...全文
520 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
aaaa3105563 2009-04-30
  • 打赏
  • 举报
回复
帮顶··
wutaihua 2009-04-30
  • 打赏
  • 举报
回复
mark下
fandh 2009-04-30
  • 打赏
  • 举报
回复
这方面,cximage做的很好,不仅仅开源,还提供例子、说明,我给你网址,你自己下载吧,这个非常好用,我强烈推荐楼主用这个:
http://www.codeproject.com/KB/graphics/cximage.aspx
lrdcf 2009-04-30
  • 打赏
  • 举报
回复
刚看了看你给的那个网站, 你是要底层的解码工作么?
图像文件头 ,图像信息头 这些信息的偏移都给你了,那你read出来,给相应大小的结构就行嘛,
,然后用一个大小足够大的地址空间来read图像信息(就是写到内存,只是针对无压缩的)

对于有压缩的,我不会解压缩算法,个人认为,那玩意属于商业机密,轻易不容易知道的。
楼主不会陷入什么误区吧?
#Page# 2009-04-30
  • 打赏
  • 举报
回复
呵呵,你可以找找开源的
lrdcf 2009-04-30
  • 打赏
  • 举报
回复
可是使用 imgdecmp 库来解码
使用如下:
首先引入 imgdecmp.h 头文件
然后这么使用:
DecompressImageInfo 这个结构是又头文件导出的,声明自己看那个头文件:

HDC hdc = CreateCompatibleDC(NULL);

DecompressImageInfo dii;

BYTE szBuffer[1024] = {0};
HANDLE hFile = INVALID_HANDLE_VALUE;

// Fill in the 'DecompressImageInfo' structure
dii.dwSize = sizeof( DecompressImageInfo ); // Size of this structure
dii.pbBuffer = szBuffer; // Pointer to the buffer to use for data
dii.dwBufferMax = 1024; // Size of the buffer
dii.dwBufferCurrent = 0; // The amount of data which is current in the buffer
dii.phBM = &hBitmap; // Pointer to the bitmap returned (can be NULL)
dii.ppImageRender = NULL; // Pointer to an IImageRender object (can be NULL)
dii.iBitDepth = GetDeviceCaps(hdc,BITSPIXEL); // Bit depth of the output image
dii.lParam = ( LPARAM ) &iCeBMPFile;//hFile; // User parameter for callback functions
dii.hdc = hdc; // HDC to use for retrieving palettes
dii.iScale = 100; // Scale factor (1 - 100)
dii.iMaxWidth = 10000; // Maximum width of the output image
dii.iMaxHeight = 10000; // Maxumum height of the output image
dii.pfnGetData = GetImageData; // Callback function to get image data
dii.pfnImageProgress = ImageProgress; // Callback function to notify caller of progress decoding the image
dii.crTransparentOverride = ( UINT ) -1; // If this color is not (UINT)-1, it will override the
// transparent color in the image with this color. (GIF ONLY)

// Process and decompress the image data
typedef HRESULT (CALLBACK* ULPRET)( DecompressImageInfo* pParams );

HINSTANCE hLib;
ULPRET lpfnDLLProc;

hLib = LoadLibrary ( L"Imgdecmp.dll" );
if ( hLib )
{
lpfnDLLProc = (ULPRET) GetProcAddress ( hLib, L"DecompressImageIndirect" );
hr = (*lpfnDLLProc) ( &dii );
FreeLibrary ( hLib );
}

// Clean up
DeleteDC( hdc );

19,464

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 图形处理/算法
社区管理员
  • 图形处理/算法社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧