Quote:....snip...can it be modified to output as a png as well?
It can, If you have IM from a linux repo then the command magick probably = convert. I use the linux magick appimage from their site.
Many formats supported typically
magick infile.ext outfile.ext
...although if you want infile.png > (modified) infile.png write the new file to a new folder and apply a path in the commandline.
edit: just a reminder the images are sequentially numbered 1.png 2.png....n.png the list.txt file contains the random numbers, one per line. Lookup the linux shuf command.