3

How can I open multiple images files using ImageMagick's display command? If I enter say display *.png in a directory containing multiple PNG files, only one is displayed. I think I'd prefer them to appear one at a time, but all at once could be useful too.

2 Answers 2

7

If you don't specify a delay, imagemagick will load the first image and wait for your input, that is

SPACE - load next image
BACKSPACE - load previous image

If you want to display the images in sequence without interaction, use a delay:

display -delay 50 *.png

To display all of them you could try with

display 'vid:*.png'
1

If you would like to see all your images at once, you can use montage to group them into a single, temporary image in ImageMagick's MIFF format (which is lossless regardless of whether image has alpha channels or 8/16/32 bit integer/float samples) and tell display to show that:

display <(montage *.png MIFF:-)

The nice thing about this is that montage will lay out your images sensibly according to how many you have:

If you have 3 images:

enter image description here

If you have 4 images:

enter image description here

If you have 8 images:

enter image description here

If you have 9 images:

enter image description here


If you prefer to layout your images yourself, rather than let montage do them automagically, you can specify how many columns (i.e. how many images across the screen) you'd like and it will make as many rows as necessary. So, say you wanted 3 images in each row:

display <(montage *.png -tile 3x MIFF:-)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .