0

Can't find an option for Imagemagick's display command to avoid decorations. Just need to show the image, is there any way to achieve this, or any other "core" command that can do it?

nightcod3r
  • 752
  • 1
  • 7
  • 26

1 Answers1

3

I'm assuming you mean to display images without window decorations. There's many many ways to achieve this, but I would like to point-out that your OS/desktop-manager probably has something that you can leverage.

For example, on my mac, I can use open & qlmanage to show images with minimal decorations.

# Use OS defaults
open wizard.png
# or Quicklook
qlmanage -p wizard.png

qlmanage

YMMV. There's also great alternatives listed to this question.

ImageMagick's display utility has the options -immutable, -backdrop, & -window options to interact with X11 display system. If you don't mind X11's tile bar, then -immutable will hide the additional display widgets.

display -immutable -resize 40% wizard.png

immutable

However, if you absolutely do not want any window decoration, then you may need to role your own solution. The -window option will set the image as a background to a running window. Knowning this, I just need to create a borderless-window & capture an ID to pass to identify. See this answer for creating a window w/o any decoration.

// simple_window (compile with `gcc -L/usr/X11R6/lib -lX11 -o simple_window simple_window.c')
#include <stdio.h>
#include <X11/Xlib.h>

int main(int argc, const char * argv[]) {
    Display * root;
    Window win;
    int screen;
    root = XOpenDisplay(NULL);
    screen = DefaultScreen(root);
    win = XCreateSimpleWindow(root,
                              RootWindow(root, screen),
                              10, 10,
                              400, 600,
                              0,
                              BlackPixel(root, screen),
                              WhitePixel(root, screen));
    Atom win_type = XInternAtom(root, "_NET_WM_WINDOW_TYPE", False);
    long value = XInternAtom(root, "_NET_WM_WINDOW_TYPE_DOCK", False);
    XChangeProperty(root,
                    win,
                    win_type,
                    4, 32,
                    PropModeReplace,
                    (unsigned char *) &value, 1);
    XMapWindow(root, win);
    printf("Window created %lu\n", win);
    XEvent e;
    while(1) {
        XNextEvent(root, &e);
        if (e.type == KeyPress) {
            break;
        }
    }
    XCloseDisplay(root);
    return 0;
}

Compiling the above program & running will print out the current window id; which, I can now pass the import utility to write the image as a background.

no decorations

A bit hack-ish, but again, YMMV.

Community
  • 1
  • 1
emcconville
  • 23,800
  • 4
  • 50
  • 66