wiki:script_convert_images_webp_jpeg
Table of Contents
Script to convert images from webp to jpeg
- convert.sh
#!/bin/bash # requires imagemagick package # apt install imagemagick IMAGE_DIR='/home/antisa/ncimages' WEBPS=($(find ${IMAGE_DIR} -type f -name '*xxl.webp')) JPEGS=($(find ${IMAGE_DIR} -type f -name '*xxl.jpeg')) for WEBP_IMAGE in ${WEBPS[@]} do if [[ "${JPEGS[@]}" =~ "${WEBP_IMAGE%.*}.jpeg" ]]; then echo "Image already converted to jpeg, skipping..." else echo ">>>>>>>>>>>>>>> Converting ${WEBP_IMAGE} to jpeg..." mogrify -format jpeg ${WEBP_IMAGE} fi done
Tested on
See also
References
wiki/script_convert_images_webp_jpeg.txt · Last modified: 2023/07/14 10:41 by antisa