# @eva/texture-compressor

> compressed texture generation scheme for eva.js

Latest version **0.2.0** (published 2021-12-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install @eva/texture-compressor
pnpm add @eva/texture-compressor
yarn add @eva/texture-compressor
bun add @eva/texture-compressor
```

Provides the command `eva-compress`.

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; large bundle; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2021-12-23 |
| First published | 2021-11-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 29.3 MB |
| Known vulnerabilities | 0 (+4 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 7 |
| Author | aspsnd |
| Maintainers | aspsnd, az8641683, bezos, wiseyuri |

## Links

- npm: https://www.npmjs.com/package/@eva/texture-compressor
- Repository: https://github.com/eva-engine/texture-compressor
- Homepage: https://github.com/eva-engine/texture-compressor#readme
- Issues: https://github.com/eva-engine/texture-compressor/issues
- npm.io page: https://npm.io/package/@eva/texture-compressor

## Dependencies (2)

- [sharp](https://npm.io/package/sharp.md) ^0.29.3
- [minimist](https://npm.io/package/minimist.md) ^1.2.5

## Recent versions

- 0.2.0 (latest) — 2021-12-23
- 0.1.0 — 2021-11-30
- 0.0.1 — 2021-11-26

## 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,
})
```

---
_Source: https://npm.io/package/@eva/texture-compressor · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
