mirror of
https://github.com/kneutron/ansitest.git
synced 2025-01-16 04:42:55 +08:00
Add files via upload
This commit is contained in:
parent
602fbf16a0
commit
4f38832fd9
46
mk-index-jpg.sh
Normal file
46
mk-index-jpg.sh
Normal file
@ -0,0 +1,46 @@
|
||||
#!/bin/bash
|
||||
|
||||
# 2022 Dave Bechtel
|
||||
# Create an index .jpg with thumbnails for images in multiple subdirs, one index jpg per subdir
|
||||
# REF: https://ostechnix.com/how-to-create-a-montage-from-images-in-linux/
|
||||
|
||||
# CD to where you need to be b4 running
|
||||
# cd $HOME/Pictures $ $0
|
||||
|
||||
# REQUIRES: imagemagick , findutils , parallel
|
||||
|
||||
# del existing montage jpg first so we dont do Inception
|
||||
outfile=0montage.jpg
|
||||
|
||||
set -u # abort on uninit var
|
||||
echo "Precleaning $outfile in this dir tree"
|
||||
find . -name "$outfile" -print -delete
|
||||
set +u
|
||||
|
||||
if [ "$1" = "" ]; then
|
||||
echo "Single tasking"
|
||||
time find . -type d -print -exec montage -geometry 192x192\>+1+1 -set label '%f\n%wx%h' {}/\* {}/$outfile \;
|
||||
else
|
||||
echo "Using multi-cpu"
|
||||
time find . -type d -print \
|
||||
| parallel -I@ --max-args 1 \
|
||||
montage -geometry 192x192\>+1+1 -set label '%f\n%wx%h' @/\* @/$outfile
|
||||
# WARNING be aware that montage can use MULTIPLE GIGS OF RAM
|
||||
fi
|
||||
|
||||
# ^ Find directories starting in this dir (and processing current directory
|
||||
# as well), print what it finds to somewhat track progress, run montage on
|
||||
# the files in that dir (you need to escape the star to avoid bash
|
||||
# autocomplete) with resulting output file named 0montage.jpg in the found dir.
|
||||
# PROTIP Prefacing the filename with 0 should sort it to the top in a file manager
|
||||
|
||||
date
|
||||
|
||||
exit;
|
||||
|
||||
Use "find * " to only process subdirs, not curdir
|
||||
|
||||
REF: https://opensource.com/article/18/5/gnu-parallel
|
||||
|
||||
$ find . -name "*jpeg" | parallel -I% --max-args 1 convert % %.png
|
||||
-I% creates a placeholder, called %, to stand in for whatever find hands over to Parallel.
|
Loading…
x
Reference in New Issue
Block a user