简体   繁体   中英

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 (eg in dired via Ct Ct). However, opening them fails (opens as garbage in fundamental mode, and Mx 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 .

要显示您的Emacs for Windows版本需要哪个版本的PNG dll,您可以评估(cdr (assq 'png dynamic-library-alist))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM