c – CImg错误:’gm.exe’未被识别为内部或外部命令,
我是c编程新手,今天我尝试使用CImg保存图像.
CImg是C模板图像处理库. 我写的基本代码是(请原谅任何语法错误,作为我的代码的复制部分): #include "CImg.h"// Include CImg library header. #include <iostream> using namespace cimg_library; using namespace std; const int screen_size = 800; //------------------------------------------------------------------------------- // Main procedure //------------------------------------------------------------------------------- int main() { CImg<unsigned char> img(screen_size,screen_size,1,3,20); CImgDisplay disp(img,"CImg Tutorial"); //Some drawing using img.draw_circle( 10,10,60,RED); img.save("result.jpg"); // save the image return 0; } 但我无法运行我的程序,因为它说: Invalid Parameter - 100% 'gm.exe' is not recognized as an internal or external command,operable program or batch file. This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information. [CImg] *** CImgIOException *** [instance(800,800,02150020,non-shared)] CImg<unsigned char>::save_other() : Failed to save file 'result.jpg'. Format is not natively supported,and no external commands succeeded. terminate called after throwing an instance of 'cimg_library::CImgIOException' what(): [instance(800,and no external commands succeeded. 虽然我可以看到图像,但我无法保存. 解决方法
我有同样的错误,并安装GraphicsMagick(不是ImageMagick)帮助了我.
我已经从ftp://ftp.graphicsmagick.org/pub/GraphicsMagick/windows/下载并安装了GraphicsMagick-1.3.26-Q8-win64-dll.exe.如果需要,您可以选择另一个:
重要提示:在安装过程中,请不要删除“更新可执行搜索路径”复选框,它会更新环境变量%PATH%,从而可以从任何地方使用gm.exe. 在我的情况下,还需要安装Ghostscript – 强烈建议由GraphicsMagick安装.有一个链接到x64 Ghostscript:https://sourceforge.net/projects/ghostscript/files/GPL%20Ghostscript/9.09/gs909w64.exe/download(我把它放在这里,因为来自GraphicMagick网站的链接只引导你到32位). 在那之后,它对我来说很好. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |