推荐一个开源的高效头像生成工具,支持API调用

推荐一个开源的高效头像生成工具,支持API调用_第1张图片

一、简介

  • 集成多种头像生成方案,包括:ugly-avatar、multiavatar、jdenticon、facesjs、dicebear等
  • 支持docker部署,支持API调用
  • 项目开源地址:GitHub - luler/hello_avatar: 轻松搭建生成简易头像的api服务

二、安装

  1. 准备好docker、docker-compose环境
  2. 新建docker-compose.yml,配置内容如下:
version: '3'
services:
  hello_avatar:
    image: dreamplay/hello_avatar
    restart: always
    ports:
      - 13130:13130

     3. 命令启动

docker-compose up -d

三、使用

  1. 通过访问在线页面使用,访问地址:http://localhost:13130/

推荐一个开源的高效头像生成工具,支持API调用_第2张图片

    2.通过API接口调用使用

  • API接口(GET):http://localhost:13130/avatar

  • 参数控制:

字段 是否必填 类型 简介
type string 生成头像类型:
ugly-avatar-丑头像(默认),参考:https://github.com/txstc55/ugly-avatar
multiavatar-插画头像,参考:https://multiavatar.com/
jdenticon-随机头像,参考:https://jdenticon.com/icon-designer.html
facesjs-漫画风格头像,参考:https://github.com/zengm-games/facesjs
dicebear-风格头像,参考:https://www.dicebear.com/styles/
style string 风格类型,仅当type=dicebear时有效:
male-男性风格
female-女性风格
avataaars-由Avataaars设计的头像
bottts-像素机器人
gridy-棋盘格式风格
human-贴近真实人类样貌
identicon-GitHub使用的Identicons风格的头像
initials-显示用户初始字母的简单风格
seed string 头像生成种子变量,仅当type=dicebear且style=initials时有效
gender string 头像生成性别,仅当type=facesjs时有效

四、总结

  • 能够docker一键部署,高效生成多种类型的头像,可以满足多数应用开发场景需求
  • 可以作为一个独立的头像生成服务,通过API的方式集成到第三方系统
演示地址参考: 我这个咩应用

你可能感兴趣的:(经验分享,开源软件)