Windows 下的 Emacs 和 PNG 文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2650041/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Emacs under Windows and PNG files
提问by Leo Alekseyev
Would anyone have any pointers on getting PNG images to display in Emacs 23 under Win32?.. I have installed the gnuwin32 set of utilities, including libpng and zlib; C:\Program Files\GnuWin32\bin is in path. JPG files started working but not PNGs. I'd appreciate any hints on getting this to work.
有没有人有关于在 Win32 下的 Emacs 23 中显示 PNG 图像的任何指示?.. 我已经安装了 gnuwin32 实用程序集,包括 libpng 和 zlib;C:\Program Files\GnuWin32\bin 在路径中。JPG 文件开始工作,但 PNG 不工作。我很感激任何有关使其工作的提示。
EDIT: PNG thumbnails actually display fine (e.g. in dired via C-t C-t). However, opening them fails (opens as garbage in fundamental mode, and M-x image-mode says "invalid image specification").
编辑:PNG 缩略图实际上显示良好(例如通过 Ct Ct 显示)。但是,打开它们会失败(在基本模式下作为垃圾打开,并且 Mx 图像模式表示“无效的图像规范”)。
采纳答案by Oleg Pavliv
You have to copy one of these dlls "libpng12d.dll" "libpng12.dll" "libpng.dll" "libpng13d.dll" "libpng13.dll" to your emacs-23.1/bin/ directory. They require zlib1.dll which you have to copy as well. I did the same thing for jpeg62.dll and giflib4.dll and now my emacs supports jpg, gif and png files. For some reason it does not work if I simply put these dlls in the path.
您必须将这些 dll 之一“libpng12d.dll”“libpng12.dll”“libpng.dll”“libpng13d.dll”“libpng13.dll”复制到您的 emacs-23.1/bin/ 目录。它们需要 zlib1.dll,您也必须复制它。我对 jpeg62.dll 和 giflib4.dll 做了同样的事情,现在我的 emacs 支持 jpg、gif 和 png 文件。出于某种原因,如果我只是将这些 dll 放在路径中,它就不起作用。
You can check (image-type-available-p 'png)
to see if png is supported. image-library-alist
maps image type to a list of dlls which support it.
您可以检查(image-type-available-p 'png)
是否支持 png。image-library-alist
将图像类型映射到支持它的 dll 列表。
回答by Bozhidar Batsov
According to the official manual:
根据官方手册:
3.3 How do I get image support?
3.3 如何获得图像支持?
Emacs has built in support for XBM and PBM/PGM/PPM images. This is sufficient to see the monochrome splash screen and tool-bar icons. Since 22.2, the official precompiled binaries for Windows have bundled libXpm, which is required to display the color versions of those images.
Emacs 内置了对 XBM 和 PBM/PGM/PPM 图像的支持。这足以看到单色启动屏幕和工具栏图标。从 22.2 开始,Windows 的官方预编译二进制文件捆绑了 libXpm,这是显示这些图像的颜色版本所必需的。
Emacs is compiled to recognize JPEG, PNG, GIF and TIFF images also, but displaying these image types require external DLLs which are not bundled with Emacs. See Other useful ports.
Emacs 也经过编译以识别 JPEG、PNG、GIF 和 TIFF 图像,但显示这些图像类型需要未与 Emacs 捆绑的外部 DLL。请参阅其他有用的端口。
Those dlls for the various image formats are (as far as I know) - XPM (xpm4.dll), PNG (libpng13.dll, zlib1.dll), JPEG (jpeg62.dll), TIFF (libtiff3.dll) and GIF (giflib4.dll);
各种图像格式的 dll 是(据我所知) - XPM (xpm4.dll)、PNG (libpng13.dll、zlib1.dll)、JPEG (jpeg62.dll)、TIFF (libtiff3.dll) 和 GIF ( giflib4.dll);
回答by FlyingFoX
Starting with Emacs 25 the Emacs Windows download directoryincludes -deps
zip packages, that can be extracted to your emacs installation folder and include image libraries for PNG, SVG, JPEG, GIF, TIFF and more.
从 Emacs 25 开始,Emacs Windows 下载目录包含-deps
zip 包,可以解压缩到您的 emacs 安装文件夹,并包含 PNG、SVG、JPEG、GIF、TIFF 等图像库。
See also this emacs.stackexchange answer.
另请参阅此emacs.stackexchange 答案。
回答by David
To display which version of the PNG dll your Emacs for Windows version requires, you can evaluate (cdr (assq 'png dynamic-library-alist))
要显示您的 Emacs for Windows 版本需要哪个版本的 PNG dll,您可以评估 (cdr (assq 'png dynamic-library-alist))