Advertisement
Guest User

median_stacking

a guest
Oct 30th, 2021
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.06 KB | None | 0 0
  1. #!/bin/bash
  2. echo "this will delete all tif files in subfolders"
  3. echo "press enter to continue, or type 'upscale' and then press enter to continue with upscaling"
  4. echo "upscaling did not yield any improvement in image quality for me tho"
  5. echo "you may need to edit /etc/ImageMagick-6/policy.xml for this to work, particularly memory and disk entry"
  6. echo "6 might be another number on your machine"
  7.  
  8. read upscale
  9.  
  10.  
  11. #iterate over folders
  12. for dir in ./*/
  13. do
  14.  
  15. cd $dir
  16.  
  17. echo $dir
  18.  
  19. #align images, the "2>/dev/null" part discards warnings
  20. #call it twice since shell is case sensitive
  21. #assumes all images have same ending case
  22. align_image_stack -a OUT *.jpg 2>/dev/null
  23. align_image_stack -a OUT *.JPG 2>/dev/null
  24.  
  25. #upscale images
  26. if [ $upscale = "upscale" ]
  27. then
  28. echo "upscaling..."
  29. mogrify -resize 200% *.tif
  30. echo "done upscaling..."
  31. else
  32. echo "skipping upscaling..."
  33. fi
  34.  
  35.  
  36. #find median, write to base folder
  37. echo "finding median..."
  38. convert *.tif -evaluate-sequence median ../${dir%*/}.jpg
  39.  
  40. #delete temporary files
  41. rm *.tif
  42.  
  43. cd ..
  44.  
  45. echo "done!"
  46. done
  47.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement