Advertisement
metalx1000

Generate Random Avatar BASH

Aug 26th, 2021
2,136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.18 KB | None | 0 0
  1. #!/bin/bash
  2. ######################################################################
  3. #Copyright (C) 2021  Kris Occhipinti
  4. #https://filmsbykris.com
  5.  
  6. #This program is free software: you can redistribute it and/or modify
  7. #it under the terms of the GNU General Public License as published by
  8. #the Free Software Foundation version 3 of the License.
  9.  
  10. #This program is distributed in the hope that it will be useful,
  11. #but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13. #GNU General Public License for more details.
  14.  
  15. #You should have received a copy of the GNU General Public License
  16. #along with this program.  If not, see <http://www.gnu.org/licenses/>.
  17.  
  18. #Generates random avatars using https://avatars.dicebear.com
  19. ######################################################################
  20.  
  21. seed="$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w ${1:-32} | head -n 1)"
  22. types=("male" "female" "bottts" "human")
  23. size="128"
  24.  
  25. #download avatars
  26. for t in "${types[@]}"
  27. do
  28.   wget -q "https://avatars.dicebear.com/api/${t}/avatar-${t}-${seed}.svg?h=${size}&w=${size}" -O ${t}-${seed}.svg
  29.   echo ${t}-${seed}.svg
  30. done
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement