2

I have installed imagemagick @7 using 'brew' on a Big Sur Mac. The 'display' option gives an error "display: delegate library support not built-in (X11)".

This is not a mystery. The solution used to be to install imagemagick with some -with-X11 option. This option has gone from the latest 'brew' builds. It may be back someday, but I understand the X11 support was problematic. If this is so, then building from source sounds tricky.

I can convert my weird format files to another format, and open them in some compatible viewer. I want to look at floating-point files without worrying that the values may have been clipped by format conversion. I might use python matplotlib. But is there a neater way?

Following from the comments, I installed 'xquartz' and built ImageMagick 7.0.10 from source. My current version was done with ./configure --with-modules (this is probably not needed for what I wanted). The configure reports showed that the X11 libraries were found and linked. 'make check' passed. The environment variable DISPLAY is set to :0. But if I try to display an image with (for example)...

magick display logo.gif ...I get... display: unable to open X server `:0' @ error/display.c/DisplayImageCommand/412.

This is progress: it is trying to connect but isn't managing it. I find lots of possible solutions from about 2018, but nothing on version 7 (which I need) on Big Sur.

ImageMagic display now works for me. I rebooted the Mac (may not have been necessary but someone advised this). I deleted the export DISPLAY=":0" - this was a relic from earlier experiments. I run Xquartz, which sets up the Display to something long and complicated, and as long as XQuartz is running, commands work from any terminal. Thanks, everyone.

4
  • Write the data to disk, and use the open utility to "display". It's pretty easy to associate the default application to a file type. Hex Fiend is pretty good for raw binary. Commented Dec 15, 2020 at 14:22
  • 1
    Install XQuartz. See xquartz.org
    – fmw42
    Commented Dec 15, 2020 at 19:00
  • 1
    Try xclock first and see if the basic XQuartz server is working - independently of ImageMagick. Your DISPLAY environment variable looks suspicious - how did it get set? Mine is /private/tmp/com.apple.launchd.086Ppo9AM7/org.macosforge.xquartz:0 Commented Dec 16, 2020 at 13:17
  • Yes. This was a relic from some earlier experiments. I got rid of this and everything is now working. Commented Dec 16, 2020 at 15:32

1 Answer 1

1

Recent versions of homebrew have dropped support for X11 using the --with-X11 option to ImageMagick. That means you cannot readily use commands like the following that display an image directly without having to save it to disk and open some non-ImageMagick viewer:

magick -size 640x480 xc:red display:

However, you can use macOS's built-in Image Preview in a very analogous way, by adding your own "delegate". Just create a file with these contents:

<delegate decode="png" encode="display" spawn="True" command="magick %i %u.png && /usr/bin/open -a Preview %u.png"/>

and save it as $HOME/.config/ImageMagick/delegates.xml That tells ImageMagick that when you put display: at the end of the command, it should take the current image, make a temporary PNG version of it and use the Preview app to display it.

Now, whenever you want to view the output of an ImageMagick command just use:

magick INPUTIMAGE ... processing ... display:
3
  • Mark, you should mention that there is XQuartz to replace X11 and be able to use display: without your alternate method
    – fmw42
    Commented Nov 29, 2023 at 17:14
  • @fmw42 Hi Fred. The point I am trying to make is that, if you install ImageMagick via homebrew, you cannot link it with X11 any more so even if you have XQuartz installed, it will not work - per the first line of OP's question. homebrew ships ImageMagick without the ability to interact with anything X11 at all, and there is no easy way to enable it - short of doing a custom build using ./configure and make and all that jazz. Commented Nov 29, 2023 at 17:36
  • Mark Setchell Thanks for the update Mark. That makes it much more clear.
    – fmw42
    Commented Nov 29, 2023 at 17:47

Not the answer you're looking for? Browse other questions tagged or ask your own question.