Emacs under Windows and PNG files
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.
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").开发者_开发知识库
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.
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.
According to the official manual:
3.3 How do I get image support?
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 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.
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);
Starting with Emacs 25 the Emacs Windows download directory includes -deps
zip packages, that can be extracted to your emacs installation folder and include image libraries for PNG, SVG, JPEG, GIF, TIFF and more.
See also this emacs.stackexchange answer.
To display which version of the PNG dll your Emacs for Windows version requires, you can evaluate (cdr (assq 'png dynamic-library-alist))
精彩评论