Projecting random images/montages

2019-08-21 04:10发布

I am working on an installation that projects selected random images from a large folder (over 50,000 jpeg of different sizes).

I have already posted and received help about this here: Shell script to open random jpegs with ImageMagick

#!/bin/bash
# Get list of files into array - just once at start
files=(*.jpg)

# Do forever
first=0
while :; do
   # Shuffle array
   files=( $(shuf -e "${files[@]}") )

   # Make montage of first 5 images in shuffled array
   montage -background '#000000' ${files[0]} ${files[1]}  ${files[2]} ${files[3]} ${files[4]} ${files[5]} ${files[6]} mon$

   # Start displaying if first pass - leaving "display" running in background updating itself every second
   if [ $first -eq 0 ] ; then
      display -update 1  montage.jpg &
      first=1
   fi

   # Snooze 10 and repeat
   sleep 1
done

For each iteration I would like a random amount of images (for example between 1- 10 images) to be selected and projected.

I would like for this montage to be full screen - so that there are no windows or anything displaying, just the montage featuring x amount of images.

My Questions are:

How can I select a random number of images (1-10) from the folder to create a montage.jpg

and

How can I load a montage jpeg as full screen?

0条回答
登录 后发表回答