如何使用ImageMagick Magick 将图像作为gif写为blob
how to write images as gif to blob using imagemagick Magick++
vector<Magick::Image> frames;
int delay = 20;
for(auto iter=taskList.begin(); iter != taskList.end(); ++iter){
/* hide some codes here*/
frames.push_back(*img);
}
// write images to file, works fine
Magick::writeImages(frames.begin(), frames.end(), "xxx.gif");
Magick::Blob tmpBlob;
// write images to blob, I then decode the data in blob,
// and write this blob to yyy.gif. The gif file only contains the first frame image.
Magick::writeImages(frames.begin(), frames.end(), &tmpBlob, true);
// the length is far too small
LOG_DEBUG("blob data length: %d", tmpBlob.length());
// read from the blob into a imagelist, and print the size of the list
// the size is 1
vector<Magick::Image> image_list;
Magick::readImages(&image_list, tmpBlob);
LOG_DEBUG("new frames length: %d", image_list.size());
嗨,当我尝试用ImageMagick(版本7.0.3(magick stl.h WriteMages函数写入图像列表时,我有问题。它无法正常工作,似乎只写了一个框架。但是有了相同的图像列表,将它们写入GIF文件的工作正常。有人可以帮我吗?
解决了问题。我失败的原因是我没有做img-> magick(" gif"(,这导致写作不正确。
相关文章:
- C++中大多数/所有 setter 函数的参数是否应该写为常量引用?
- 将手写循环转换为标准库调用
- 引发异常:写访问冲突. temp 为 nullptr
- 将较大的整数写为二进制并读回它们会产生不好的结果
- 有没有更好的方法来为C++写这个?
- 我应该如何为包含动态数组的类编写所需的构造函数
- 如何为unique_ptr管理的数组编写自定义删除器?
- Eigen::结构中包含的矩阵被 pybind11 标记为不可写
- 如何在以 256 为基数的唯一 xLen-digit 表示中写一个整数 x?
- 如何为包含map<int,*double>成员的类编写析构函数?
- 如果要测试,我是否应该将C 代码写为静态或动态库
- 为模板类编写二进制加法运算符. 编译错误
- "如何用我的编码给面试官留下深刻印象?我可以在我为题材写的代码中采用哪些做法来打动面试官?
- 如何使用ImageMagick Magick 将图像作为gif写为blob
- 如何在Visual Studio c ++中将GIF显示为splash
- 在 C/C++ 中将非常大的 int(写为字符串)转换为二进制字符串
- 如何将boost::shared_ptr写为null
- 如何在C++中将负数写为无符号文字
- 将字符写为C++字节
- N=2^x,如果为真就写为真.为什么是错的