Skip to content

Automatically cut and compress png images, and then package all the images into a sprite image.

Notifications You must be signed in to change notification settings

sivanzheng/texture-merger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TEXTURE-MERGER

Install

npm install texture-merger

Usage

    import merger from 'texture-merger';
    /**
     *  Return a collection of sprites merged by four different algorithms, (Max Side, Area, Width Priority, Height Priority)
     *  @typedef {{ x: Number, y: Number, height: Number, width: Number, image: HTMLImageElement }} Layout
     *  @param {Array<String>} dataUrls - Pictures URL or Base64
     *  @param {Number} verticalGap - default 0
     *  @param {Number} horizontalGap - default 0
     *  @returns {Array<{ key: string, layout: Array<Layout>, blob: Blob }>}
     */
    const merged = await merger(dataUrls, verticalGap, horizontalGap);

Document

https://github.com/sivanzheng/Share/blob/master/Sprite/README.md

Demo online

https://sivanzheng.github.io/texture-merger-test/dist/index.html

About

Automatically cut and compress png images, and then package all the images into a sprite image.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published