cdrom
cdrom

Reputation: 599

Display command result with imagemagick cli

So in my workfow I often do something like :

convert image.png -level 10x90% tmp.png # try a command on a temporary file
display tmp.png # display the image to see if it looks good
rm tmp.png # delete the temporary file
mogrify -level 10x90% image.png # finaly apply the command to the image.

What I would like is a way to directly see the result of the command without creating a tmp file. Something like :

convert image.png -level 10x90% | display # this does not exist

or

display -level 10x90% test.png # this neither

A way to quickly display an imagemagick command result before doing it.

does it exist

Upvotes: 3

Views: 417

Answers (2)

Mark Setchell
Mark Setchell

Reputation: 207465

You can do it like this:

magick -size 1024x768 xc:red miff:- | display miff:-

You can probably always reduce that to:

magick -size 1024x768 xc:red miff: | display

MIFF is guaranteed to support all data types and any number of channels so it is a good general purpose choice.


So, in general:

magick IMAGE ...process... miff: | display

Note that you can use a different viewer if you wish, e.g. feh:

magick IMAGE ...process... PNG:- | feh -

Upvotes: 4

fmw42
fmw42

Reputation: 53071

On Unix-based Imagemagick you can use the show: command to view an image without saving it to disk.

magick -size 100x100 xc:red show:

Upvotes: 4

Related Questions