Advertisement
Guest User

Untitled

a guest
Jul 21st, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # Create the folder to store Next Gen images
  4. mkdir ./Images/JP2Files
  5. mkdir ./Images/WebPFiles
  6. mkdir ./Images/JXRFiles
  7.  
  8. # Go into Image directory for easier understanding
  9. cd Images
  10.  
  11. # Loop through all images in the Image directory
  12. for file in *; do
  13. # This means, do not run this code on a directory, only on a file (-f)
  14. if [[ -f $file ]]; then
  15.  
  16. fileName=$(echo $file | cut -d'.' -f 1) # something.jpg -> something
  17.  
  18. # Conversion to Next Gen formats, using solely imageMagick defaults
  19. # 100 is used as the default generally lessens the quality of the image
  20. convert $file -quality 100 ./WebPFiles/$fileName.webp
  21. convert $file ./JP2Files/$fileName.jp2
  22. convert $file ./JPXFiles/$fileName.jpx
  23. convert $file ./JXRFiles/$fileName.jxr
  24.  
  25. fi
  26.  
  27. done
  28.  
  29. # Go back down
  30. cd ..
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement