Giter Club home page Giter Club logo

poster-generater's Introduction

poster-generater

⚡⚡⚡海报生成器. 只需要一个简单的 json 配置即可生成你需要的海报...

详细文档

使用文档

新版功能更丰富

  • 基于 java 开发,部署和二次开发更方便
  • 图片将上传到 公共 CDN,不占用主机磁盘,且速度更快
  • 支持结果缓存,相同的 海报配置 不会重复渲染,一次渲染持续保存,速度更快
  • 添加删除结果 API
  • 支持自定义字体,运行目录下新建 fonts 文件夹,里面放 ttf 格式字体就行。
  • 支持模板图片,减少网络图片加载,运行目录下新建 templates 文件夹,支持多种图片格式。
  • 缓存网络图片,减少网络图片加载
  • 支持企业定制化开发部署,详情请联系我

ps:自定义字体、模板图片、网络图片缓存路径均可配置。具体配置参考 example.application.properties

组件参数解释

config字段

字段 类型 必填 描述
width Number(单位:px) 画布宽度
height Number(单位:px) 画布高度
backgroundColor String 画布颜色
blocks Object Array(对象数组) 看下文
texts Object Array(对象数组) 看下文
images Object Array(对象数组) 看下文
lines Object Array(对象数组) 看下文

blocks字段

字段名 类型 必填 描述
x Number(单位:px) 块的坐标
y Number(单位:px) 块的坐标
width Number(单位:px) 如果内部有文字,由文字宽度和内边距决定
height Number(单位:px)
paddingLeft Number(单位:px) 内左边距
paddingRight Number(单位:px) 内右边距
borderWidth Number(单位:px) 边框宽度
borderColor String 边框颜色
backgroundColor String 背景颜色
borderRadius Number(单位:px) 圆角
text Object 块里面可以填充文字,参考texts字段解释
zIndex Int 层级,越大越高

texts字段

字段名 类型 必填 描述
x Number(单位:px) 坐标
y Number(单位:px) 坐标
text String|Object 当Object类型时,参数为text字段的参数,marginLeft、marginRight这两个字段可用(示例请看下文)
fontSize Number(单位:px) 文字大小
color String 颜色
lineHeight Number(单位:px) 行高
lineNum Int 根据宽度换行,最多的行数
width Number(单位:px) 没有指定为画布宽度,默认为x轴右边所有宽度
baseLine String top| middle|bottom基线对齐方式
textAlign String left|center|right对齐方式
zIndex Int 层级,越大越高
fontFamily String 默认字体为'pingfangtf' ,支持自定义字体

images字段

字段 类型 必填 描述
x Number(单位:px) 右上角的坐标
y Number(单位:px) 右上角的坐标
url String 图片url(需要添加到下载白名单域名中)也支持本地图片
width Number(单位:px) 宽度(会根据图片的尺寸同比例缩放
height Number(单位:px) 高度(会根据图片的尺寸同比例缩放
borderRadius Number(单位:px) 圆角,跟css一样
zIndex Int 层级,越大越高
qrCode Bool 是否二维码图片,如果是,url内容就是二维码内容

lines字段

字段 类型 必填 描述
startX Number(单位:px) 起始坐标
startY Number(单位:px) 起始坐标
endX Number(单位:px) 终结坐标
endY Number(单位:px) 终结坐标
width Number(单位:px) 线的宽度
color String 线的颜色
zIndex Int 层级,越大越高

[email protected]
qbhy/poster-generater

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.