psd-to-templet
v1.1.16
Published
transform psd into templet
Downloads
3
Readme
psd-to-templet
transform psd into templet
Installation
use npm
npm install psd-to-templet
Usage
import psdToTemplet from 'psd-to-templet';
psdToTemplet(file, options)
.then(res => {})
.catch(err => {})
Options
defaultTextType
Specifies the scale type of text
- type:
String
- default:
block
- options:
head
、content
、block
parseSVG:
while false, parse svg as png
- type:
Boolean
- default:
true
groupMode:
Specifies the mode of parsing groups,while tag, remember to name group as [group]*
- type:
String
- default:
flat
- options:
flat
、merge
、tag
imageQuality:
- type:
Number
- default: 60
imageMaxWidth:
- type:
Number
imageMaxHeight:
- type:
Number
onProgress:
- type:
Function
- usage:
onProgress(data) {
var message = data.message;
var progress = data.progress;
}
Output
[{
backgroundColor: "#FFFFFF",
elems: [{
type: 'group',
elems: [{
height: 321,
left: 0,
opacity: 1,
top: 0,
type: "image",
url: "data:image/jpeg;base64",
width: 1242
}],
height: 321,
left: 0,
top: 1887,
width: 1242
}, {
color: '#000000',
content: '哈哈哈哈哈',
fontFamily: 'FZLTTHK--GBK1--0',
fontSize: 57,
fontStyle: 'normal',
fontWeight: 400,
height: 80.646,
left: 320,
letterSpacing: 0,
lineHeight: 1.2,
opacity: 1,
resize: 7,
textAlign: 'center',
textDecoration: 'none',
top: 56.019,
transform: {a: 1, b: 0, c: -0, d: 1, tx: 0, ty: 0},
type: 'text',
width: 602
}],
height: 2208,
title: null,
width: 1242,
}]