• ThirdNerd@lemmy.world
    link
    fedilink
    English
    arrow-up
    16
    arrow-down
    3
    ·
    1 year ago

    Here’s my solution to WebP:

    #/bin/bash
    # -----------------------------------------------------------------------------
    # FILE PURPOSE AND NOTES:
    # Convert webp files to png in current directory
    #
    # -----------------------------------------------------------------------------
    
    echo "Convert Webp to Png"
    echo
    echo "Note this only works on webp files in the current directory:"
    echo "Right now, that is $(pwd)"
    echo
    read -p "Press any key to continue"
    echo
    
    for i in *.webp; do
      echo ".. Converting $i"
      ffmpeg -hide_banner -loglevel error -i "$i" "${i%%.*}.png"
    done
    
    echo
    echo "Here are the original webp and new png files now:"
    echo
    ls *.webp *.png
    echo
    echo "Ok to delete the webp files now? (Y/n)"
    read -p ": " ANSWER
    echo
    case $ANSWER in
      n|N)
        echo "Leaving webp files."
        ;;
      *)
        echo "Removing webp files.."
        rm -v *.webp
        ;;
    esac
    echo
    
    • ᗪᗩᗰᑎ@lemmy.ml
      link
      fedilink
      English
      arrow-up
      15
      ·
      1 year ago

      What’s the purpose of converting webp files to png? Isn’t it potentially making the filesize bigger? Is it for compatibility for legacy apps?

      • DahGangalang@infosec.pub
        link
        fedilink
        English
        arrow-up
        3
        ·
        1 year ago

        Personally, imma use this script for the legacy compatibility.

        My use case is making maps and character tokens for Virtual Table Top games, and it feels like no one supports webp format. One of the standard tools I pull up when doing my thing is a webp to png converter.

      • ThirdNerd@lemmy.world
        link
        fedilink
        English
        arrow-up
        3
        ·
        1 year ago

        Personally I don’t care what format my pics are in (I don’t use that many). But I get great satisfaction converting them out of Google’s fav.