Guest User

Untitled

a guest
Nov 26th, 2015
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.94 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. #Version for 4 screens. 3 aligned and one on the top of the central one.
  4. #This script requires imagemagick
  5.  
  6. image="$*"
  7. fichier=${image##*/}
  8. home=~
  9.  
  10. #modify the line below to set the height of your screen
  11. hauteurmax=2160
  12. #modify the line below to set the width of your screen
  13. largeurmax=5760
  14.  
  15.  
  16. #set the path of destination :
  17. imagepath=$home"/Images/Triplemonitor/Coupé/"
  18.  
  19. gauche=left-
  20. droite=right-
  21. centre=center-
  22. haut=topscreen-
  23. big=big
  24. hauteur=$(identify -format "%h" $image)
  25. largeur=$(identify -format "%w" $image)
  26. entrop=$(($hauteur-$hauteurmax))
  27. entropx=$(($largeur-$largeurmax))
  28. hauteur2=$(($entrop/2))
  29. largeur2=$(($entropx/2))
  30. tiers=$(($largeurmax/3))
  31. tiersx2=$(($tiers*2))
  32. hauteurdiv2=$(($hauteurmax/2))
  33.  
  34. #copy original image in destination folder
  35. cp $image $imagepath$big$fichier
  36.  
  37. #Global cut $hauteurmax x $largeurmax
  38. mogrify -crop +0-$hauteur2 $imagepath$big$fichier
  39. mogrify -crop +0+$hauteur2 $imagepath$big$fichier
  40. mogrify -crop -$largeur2+0 $imagepath$big$fichier
  41. mogrify -crop +$largeur2+0 $imagepath$big$fichier
  42.  
  43. #Copy for top and bottom
  44. cp $imagepath$big$fichier $imagepath$haut$fichier
  45. cp $imagepath$big$fichier $imagepath$centre$fichier
  46.  
  47. #Cut top and bottom in half
  48. mogrify -crop -0-$hauteurdiv2 $imagepath$haut$fichier
  49. mogrify -crop -0+$hauteurdiv2 $imagepath$centre$fichier
  50.  
  51. #Add copies to cut (left, right)
  52. cp $imagepath$centre$fichier $imagepath$gauche$fichier
  53. cp $imagepath$centre$fichier $imagepath$droite$fichier
  54.  
  55.  
  56. #Horizontal cuts for central and top parts
  57. mogrify -crop +$tiers-0 $imagepath$centre$fichier
  58. mogrify -crop +$tiers-0 $imagepath$haut$fichier
  59. mogrify -crop -$tiers-0 $imagepath$centre$fichier
  60. mogrify -crop -$tiers-0 $imagepath$haut$fichier
  61.  
  62. #Vertical cuts for side parts
  63. mogrify -crop -$tiersx2-0 $imagepath$gauche$fichier
  64. mogrify -crop +$tiersx2-0 $imagepath$droite$fichier
  65.  
  66. #Comment the following line if you want to keep the max res file
  67. rm $imagepath$big$fichier
Advertisement
Add Comment
Please, Sign In to add comment