diff options
author | Zach van Rijn <me@zv.io> | 2023-12-06 11:51:22 -0600 |
---|---|---|
committer | Zach van Rijn <me@zv.io> | 2023-12-06 11:54:41 -0600 |
commit | 45f0edd74658f39e7ed1e61e5159f7fdb58a497d (patch) | |
tree | 2c57a5485977d0a56f866e087c91e728a480c040 | |
parent | a656ccfe9382edc96b35f716b8ccd1694c2ab4ee (diff) | |
download | wallpapers-45f0edd74658f39e7ed1e61e5159f7fdb58a497d.tar.gz wallpapers-45f0edd74658f39e7ed1e61e5159f7fdb58a497d.tar.bz2 wallpapers-45f0edd74658f39e7ed1e61e5159f7fdb58a497d.tar.xz wallpapers-45f0edd74658f39e7ed1e61e5159f7fdb58a497d.zip |
Correctly generate screenshots.
Previous versions of this script generated (and
overwrote) screenshots for each aspect ratio, so
the last one would be kept. This was incorrect.
For now, screenshots are hard-coded as 8:5 ratio
200 scale (400x250) images.
-rwxr-xr-x | prepare | 25 |
1 files changed, 16 insertions, 9 deletions
@@ -103,12 +103,13 @@ TYPE="jpg"; # Table rows MUST BE SORTED FROM GREATEST TO LEAST. # MAKE=$(grep -v ^# <<EOF -4:3 640 400 256 200 -5:4 480 256 -3:2 854 +21:9 122 16:10 160 120 105 80 16:9 240 160 120 90 -21:9 122 +8:5 200 +5:4 480 256 +4:3 640 400 256 200 +3:2 854 EOF ); @@ -237,14 +238,9 @@ size_only () y=$((${k}*${size#*:})); printf " - Generating %4sx%4s (scale: %s)\n" "${x}" "${y}" "${k}"; - # resized gm convert "${image}/${from_x}x${from_y}.png" -resize ${x}x${y}^ "${KEEP}"/${name}/${x}x${y}.${type} 2>/dev/null; done - - # screenshot - printf " - Generating screenshot\n"; - gm convert "${image}/${from_x}x${from_y}.png" -resize 400x250^ "${KEEP}"/${name}/screenshot.jpg 2>/dev/null; done } @@ -419,6 +415,17 @@ done #--------------------------------------------------------------- +# output: screenshots +#--------------------------------------------------------------- + +find "${TEMP}"/generated -mindepth 1 -maxdepth 1 -type d | sort | while read k; do + name=$(printf "%s\n" "${k}" | cut -d/ -f3); # sloppy, sorry + printf "Generating screenshot ('%s')...\n" "${KEEP}/${name}/screenshot.jpg"; + gm convert "${k}"/1600x1000.png -resize 400x250^ "${KEEP}"/${name}/screenshot.jpg 2>/dev/null; +done + + +#--------------------------------------------------------------- # output: metadata #--------------------------------------------------------------- |