0

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?

heroZero
  • 173
  • 3
  • 18
  • 1
    apologies @oguzismail edited with questions. – heroZero Jun 10 '19 at 11:03
  • Check random: https://stackoverflow.com/questions/1194882/how-to-generate-random-number-in-bash/1195035 No shuffle is then necessary. Array size/range is ${#files[@]} – lojza Jun 10 '19 at 13:48
  • ImageMagick has -format "%[fx:random()]" info:. See https://imagemagick.org/script/fx.php – fmw42 Jun 10 '19 at 16:29
  • Thanks folks...and also second quesiton as above..is it possible to have imageMagik as full screen? – heroZero Jun 10 '19 at 16:47

0 Answers0