Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Create the folder to store Next Gen images
- mkdir ./Images/JP2Files
- mkdir ./Images/WebPFiles
- mkdir ./Images/JXRFiles
- # Go into Image directory for easier understanding
- cd Images
- # Loop through all images in the Image directory
- for file in *; do
- # This means, do not run this code on a directory, only on a file (-f)
- if [[ -f $file ]]; then
- fileName=$(echo $file | cut -d'.' -f 1) # something.jpg -> something
- # Conversion to Next Gen formats, using solely imageMagick defaults
- # 100 is used as the default generally lessens the quality of the image
- convert $file -quality 100 ./WebPFiles/$fileName.webp
- convert $file ./JP2Files/$fileName.jp2
- convert $file ./JPXFiles/$fileName.jpx
- convert $file ./JXRFiles/$fileName.jxr
- fi
- done
- # Go back down
- cd ..
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement