#!/bin/bash

for FILE in *.{webp,avif,jfif}; do
  [ -e "$FILE" ] || continue

  NOEXT="${FILE%.*}"

  if [ ! -f "$NOEXT.jpg" ]; then
    convert ./"$FILE" ./"$NOEXT.jpg"

    echo "$FILE > $NOEXT.jpg"

    if [ -f ./"$NOEXT.jpg" ]; then
        rm "$FILE"
    fi
  fi
done