https://github.com/eva-engine/texture-compressor
compressed texture generation scheme for eva.js
https://github.com/eva-engine/texture-compressor
Last synced: about 1 year ago
JSON representation
compressed texture generation scheme for eva.js
- Host: GitHub
- URL: https://github.com/eva-engine/texture-compressor
- Owner: eva-engine
- Created: 2021-11-25T05:49:51.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-12-23T06:32:40.000Z (over 4 years ago)
- Last Synced: 2025-03-24T10:38:51.520Z (over 1 year ago)
- Language: TypeScript
- Size: 10.3 MB
- Stars: 6
- Watchers: 7
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# @eva/texture-compressor
The compressed texture generation scheme of eva.js can be used as CLI tool or node module
## how to use
### Installation
for using it by command line you need install @eva/texture-compressor global
```sh
$ npm i @eva/texture-compressor -g
```
or you only use it as a node module
```sh
$ npm i @eva/texture-compressor
```
### CLI
The command line provides simple configuration to enable you to generate compressed textures
```sh
eva-compress img.jpg -t astc,etc,pvrtc,s3tc
```
For more command line usage, see the help command
```sh
eva-compress -h
```
### Node Module
By calling this module, you will be able to use all activities.
```javascript
/**
* compress one image to one compress format.
* Based on this method, you can encapsulate a compressed texture workflow that is more suitable for your project.
*/
await pack({
input: './images/a.jpg',
output: './images/a.astc.jpg',
type: 'astc',
format: 'ASTC_4x4',
// compress quality, use 1--10
quality: 10,
square: false,
mipmap: true,
pot: false,
verbose: true,
flipY: false,
premultiplyAlpha: true,
})
/**
* An encapsulation of the basic pack method,
* which can more easily generate compressed textures for all files in the folder
*/
await packDir('./assets/images', {
types: {
// for one format you can give a string
astc: 'ASTC_6x6',
// for multi formats you can give a string array
etc: ['ETC1', 'ETC2_RGB'],
},
outDir: './asserts/textures',
filter: (path) => path.endsWith('.jpg') || path.endsWith('.png'),
quality: 8,
square: false,
mipmap: false,
pot: false,
verbose: true,
flipY: false,
premultiplyAlpha: false,
deepVerbose: true,
})
```