3

Update: As of early October 2016 emacs for windows does not support ImageMagick versions 7.x or greater as discussed here and here.

Presumably some combination of an earlier version of emacs for windows and ImageMagick prior to version 7.x should work. Is anybody using emacs for windows with functioning ImageMagick support (resizing images etc.)? If so, please let us know which versions of each you are using.


I want to resize images displayed inline in org mode. Apparently this requires Emacs to be compiled with Imagemagick. I need Emacs for windows, but have not found a version compiled with Imagemagick. Can someone point me to a version of Emacs for windows compiled with Imagemagick?

If I have to build a version myself, I noticed the official nt/insall.64 claims:

we need to disable Imagemagick because Emacs does not yet support it on Windows.

Is this still true?

Note, my version of Emacs for windows does have support to display images, but it is unable to resize images.

Snelephant
  • 814
  • 1
  • 7
  • 17
  • See this related reddit Emacs thread entitled "**imagemagick support on windows?**": https://www.reddit.com/r/emacs/comments/4p5o2f/imagemagick_support_on_windows/?st=itovnhtq&sh=654dd723 – lawlist Sep 29 '16 at 21:53

3 Answers3

2

I hacked some support for image scaling in windows using the imagemagick executables here: https://github.com/jkitchin/scimax/blob/master/scimax-org.el#L1158

As noted in some comments above, you need to have the mogrify program installed. With the code at that location, images get scaled in org-mode on windows for us.

John Kitchin
  • 11,555
  • 1
  • 19
  • 41
0

Edit: After some experimentation, it looks like the following information is not necessarily talking about the correct kind of ImageMagick support. I use eimp to resize images in image-mode, and eimp uses the ImageMagick utilities directly; unfortunately, I confused this with the type of ImageMagick support that the OP is talking about.


When running Emacs on non-Cygwin-equipped Windows, I use a pre-compiled version downloaded from emacsbinw64.sourceforge.net; it has ImageMagick support. Bear in mind that you will also have to install ImageMagick itself.

Update: Apparently ImageMagick support was dropped (hopefully temporarily) after I downloaded the version I'm using (25.0.50.1). I'm not sure exactly where ImageMagick support failed (according to the OP's comment, sometime prior to 25.0.94), but this page has the most complete set of downloads I can find. See this discussion thread for more information.

Aaron Harris
  • 2,664
  • 17
  • 22
  • I think currently emacs-w64 doesn't support it according to https://sourceforge.net/p/emacsbinw64/discussion/general/thread/f3f2cfdf/?limit=25. – Ben Oct 01 '16 at 13:46
  • @Ben: Ah, whoops. I guess my version was before the incompatibility then. Updated the answer to talk about this; thanks! – Aaron Harris Oct 02 '16 at 13:22
  • Following Aaron's suggestion, pre-test 25.0.94 still does not resize images. Imagemagick is installed. This is non cygwin on windows 7. Some tests reveal: `(image-type-available-p 'imagemagick) nil (getenv "PATH") "C:\\Program Files\\ImageMagick-7.0.3-Q16;` I cannot find 25.0.50.1. I will gladly use _any_ version that supports imagemagick. – Snelephant Oct 03 '16 at 18:35
  • @Snelephant Well, crap. Probably best to fall back to version 24 then. I updated the link in the answer to point to [this directory](https://sourceforge.net/projects/emacsbinw64/files/?source=navbar), since we're not sure exactly when support vanished. I'd try version 24.5-1 under `releases` next. – Aaron Harris Oct 03 '16 at 20:50
  • @AaronHarris No success with version 24.5-1 either. Does this version work for you? I'm starting to suspect I am missing something else. Images display, but do not resize. Can anyone suggest troubleshooting steps to test Imagemagick and resizing images? For example using `#+attr_org: :width 200` in the org file or `setq org-image-actual-width 600` in init.el? – Snelephant Oct 04 '16 at 16:46
  • @Snelephant For starters, can you use ImageMagick from the command line? Get an image `foo.png` and try `mogrify -resize 200% foo.png` to double its size. – Aaron Harris Oct 04 '16 at 17:04
  • @Snelephant After that, try opening the image in Emacs (just using `find-file`) and use the command `eimp-fit-image-to-window`. The image should be resized to fit the window it's in. – Aaron Harris Oct 04 '16 at 17:06
  • @AaronHarris Command line resize works. However, the latest version of Imagemagick for windows requires `magick mogrify -resize 200% foo.png` unless the legacy 'convert' is enabled during installation of Imagemagick. [http://www.imagemagick.org/discourse-server/viewtopic.php?f=1&t=30568] Perhaps this recent change in imagemagick syntax is part of the problem? – Snelephant Oct 04 '16 at 18:36
  • @AaronHarris The resized image opens in emacs. But there is no match for `M-x eimp-fit-image-to-window`. In fact, I could not find eimp.el anywhere in my installation of version 24.5-1. Is this a clue? – Snelephant Oct 04 '16 at 18:42
  • @Snelephant I suspect we're getting closer to the problem, and this is ringing bells for me; I think I may have figured this out before. When I get home from work, I'll poke around the machine I figured it out on and see what my config looks like there. – Aaron Harris Oct 04 '16 at 19:11
  • @Snelephant As for eimp, I had just forgotten that that was an external package. It might not be important, but I don't know Org mode's image handling well enough to say how to troubleshoot ImageMagick that way. And I can't get the built-in commands `image-transform-*` to do anything, even when `eimp` can use ImageMagick functionality; no idea what that means. – Aaron Harris Oct 04 '16 at 19:13
  • @Snelephant Having looked at that machine, I'm not seeing any special config, but tellingly, on that machine `(image-type-available-p 'imagemagick)` returns nil. I think that means that it doesn't have the sort of ImageMagick support you're looking for (though that might be a missing DLL or something, rather than a problem with Emacs per se), and eimp uses ImageMagick in some other way that isn't helpful to you. I'll amend the answer, and hopefully someone with more pertinent experience can chime in. Sorry! – Aaron Harris Oct 05 '16 at 01:14
0

I have released a patched version of emacs-26.0.90 for Windows (64-bit) with imagemagick 7 and pdf-tools support, among other things. Dependencies are included. Everything seems to be working. Get it here: https://github.com/m-parashar/emax64 or https://ntemacs.sourceforge.io/.

Unpatched official releases refuse to compile with either v6 or v7, and Cygwin is far too messy.