A bash script that grabs images of random sizes from Lorem Picsum. Its purpose is for quickly grabbing a batch of randomly-sized image files to be used for testing.
wget
must be installed and accessible from your terminal.
It also uses the commands echo
, ls
, rm
, seq
, and sleep
, but those are likely pre-installed on your system.
The only argument is the number of images you want to grab (default: 10).
./imgrandom <amount>
Example:
./imgrandom 10
The above example will grab 10 images of random widths and heights.
- Download the
imgrandom
file. - Run
chmod +x imgrandom
. - Run
./imgrandom
- Alternatively, you can do
sudo mv imgrandom /bin/imgrandom
orsudo mv imgrandom /usr/local/bin/imgrandom
to be able to run the command from anywhere.
If something goes wrong during the download, wget saves an empty file. When the script is done running, it cleans up the empty files. If you have less images than expected, one or more images didn't download and was cleaned up.