如何使用ImageMagick在图像中简单显示

How to simply display in image with ImageMagick?

本文关键字:简单 显示 图像 何使用 ImageMagick      更新时间:2023-10-16

我用ImageMagick创建了一个图像。我在C++工作:

int height = xxx;
int width = xxx;
uchar* raw = xxxx; // data from somewhere else
format = "Y800";
Image myImage(width, height, format, raw, width*height);

我只想以一种非常简单的方式将图像可视化到屏幕上,以确保原始数据得到正确应用。我该怎么做?

[是的,我有RTFM。如果我想显示图像文件,我所能找到的就是如何在shell中完成它]

我混淆了Zbar::Image和Magick::Image。

Zbar::Image myZbarImage(width, height, format, raw, width*height);

是Zbar::Image的构造函数,它与Magick::Image不直接兼容,后者有其构造函数手册。然后,我可以使用display()功能轻松显示:

Magick::Image myMagickImage; // fill
myMagickImage.display();