Doing an image popup from a script

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
dargaud
Posts: 31
Joined: 2006-08-06T01:58:58-07:00

Doing an image popup from a script

Post by dargaud »

Hello all,
I know how I can use "display" to show an image, but I'd like to do something a little more advanced and ask the user a question, like "Is this the right image?" and get a Y/N answer. All this from a shell script.
I don't see any direct way to do this in IM without a lot of clicking to close the window and ask the question afterwards from the command line.

Any suggestions ?
Thanks.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Doing an image popup from a script

Post by fmw42 »

You have to use unix commands and reply at the terminal. See man pages for "read"


#!/bin/bash

convert rose: show:

echo -n "Press c to continue Or q to quit:"
read -n 1 prompt

if [ "$prompt" = "q" ]; then
echo ""
echo "quitting"
exit 0
fi

echo ""
echo "script has continued"

exit 0

see also http://www.imagemagick.org/Usage/files/#show for the x: window display options (rather than show:)
dargaud
Posts: 31
Joined: 2006-08-06T01:58:58-07:00

Re: Doing an image popup from a script

Post by dargaud »

Thanks. I'd been thinking along that, but the focus changes are annoying. Someone suggested a great method using zenity here.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Doing an image popup from a script

Post by snibgo »

One method would be with HTA (hypertext application). This needs a web browser that supports HTA, of course.
snibgo's IM pages: im.snibgo.com
Post Reply