c++ - 如何在MFC2010中解码动画gif文件

标签 c++ image mfc

全部成交,

我需要在MFC2010中将动画gif格式图片解码为一些位图文件。有没有可以解码gif图片的库?我无法使用 GDIPlus,因为该程序必须在 Windows XP 上运行。如果有人为我提供库、Activex、dll 或类似的东西,我将不胜感激。

非常感谢, 谢尔文·扎格姆

最佳答案

使用 ImageMagick 的 C++ API ( Magick++ ) 非常简单:

/* list of Image to store the GIF's frames */
std::vector<Magick::Image> imageList; 

/* read all the frames of the animated GIF */
Magick::readImages( &imageList, "animated.gif" );

/* optionnally coalesce the frame sequence depending on the expected result */
Magick::coalesceImages( &imageList, imageList.begin(), imageList.end());

/* store each frame in a separate BMP file */
for(unsigned int i = 0; i < imageList.size(); ++i) {
    std::stringstream ss;
    ss << "frame" << i << ".bmp";
    imageList[i].write(ss.str());
}

关于c++ - 如何在MFC2010中解码动画gif文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16300100/

相关文章:

c++ - 处理多个文件时,我必须在 COleDropTarget::OnDrop() 中返回哪个值?

c++ - 在 MFC 计算器应用程序中连接 CString 时遇到问题

c++ - 使用函数传递的最大元素初始化数组

c++ - 在构造函数中组织初始化列表的更好方法

c++ - 具有非类型模板参数的多态性

wpf使用定时器动态改变图片源

css - GWT - 无法从 css 加载图像

css - 在 CSS 中从图像中裁剪三 Angular 形

c++ - CMFCMenuButton 的示例代码?

c++ - 适用于 Windows 的 LLVM C++ IDE