User Tools

Site Tools


wiki:script_convert_images_webp_jpeg

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

Except where otherwise noted, content on this wiki is licensed under the following license: CC0 1.0 Universal
CC0 1.0 Universal Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki