Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

texture-compressor

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

texture-compressor

CLI tool for texture compression using ASTC, ETC, PVRTC and S3TC in a KTX container.

  • 0.3.0
  • npm
  • Socket score

Version published
Weekly downloads
129K
decreased by-5.68%
Maintainers
1
Weekly downloads
 
Created
Source

Texture compressor

npm version dependencies devDependencies

CLI tool for texture compression using ASTC, ETC, PVRTC and S3TC in a KTX container.

Easily compress for all hardware using sensible defaults but with the option to pass any custom flag directly to the tool.

Installation

$ npm install -g --save texture-compressor

Live demo

Live demo and Live demo (mipmaps) using KTXLoader from Three.js.

Support table

DeviceOSOS versionBrowserBrowser versionASTCETCETC1S3TCPVRTC
Apple iPad 5thiOS11.0.3Mobile Safari11.0X
Apple iPad Air 2iOS8.4Mobile Safari8.0X
Apple iPad Mini 3iOS8.1.2Mobile Safari8.0X
Apple iPad ProiOS11.2.1Mobile Safari11.0X
Apple iPhone 5SiOS8.1.3Mobile Safari8.0X
Apple iPhone 6 PlusiOS8.1Mobile Safari8.0X
Apple iPhone 6iOS8.1.3Mobile Safari8.0X
Apple iPhone 6S PlusiOS9.0.1Mobile Safari9.0X
Apple iPhone 6SiOS9.1Mobile Safari9.0X
Apple iPhone 7iOS10.3.1Mobile Safari10.0X
Apple iPhone 8iOS11.0Mobile Safari11.0X
Apple iPhone 8iOS11.0Mobile Safari11.0X
Apple iPhone SEiOS11.2.1Mobile Safari11.0X
Apple iPhone XiOS11.2Mobile Safari11.0X
Google Nexus 5XAndroid7.0Chrome63.0.3239.111XX
Google Nexus 6PAndroid7.0Chrome63.0.3239.111XX
Google Pixel 2Android8.0.0Chrome63.0.3239.111XX
Google Pixel 2Android8.0.0Firefox51.0XX
Google PixelAndroid7.1Chrome63.0.3239.111XX
Google PixelAndroid8.0.0Chrome63.0.3239.111XX
Google PixelAndroid8.0.0Firefox51.0XX
LG G5Android6.0.1Chrome63.0.3239.111XX
MacOS High SierraMac OS10.13.3Chrome65.0.3325.181X
MacOS High SierraMac OS10.13Firefox59.0X
MacOS High SierraMac OS10.13.3Safari11.0.3X
Motorola Moto X 2nd GenAndroid6.0Chrome63.0.3239.111X
Samsung S6Android5.0.2Chrome63.0.3239.111XX
Samsung S7Android6.0.1Chrome63.0.3239.111XX
Samsung S7Android6.0.1Firefox51.0XX
Samsung S8Android7.0Chrome63.0.3239.111XX
Samsung S8Android7.0Firefox51.0XX
Samsung S8+Android7.0Chrome63.0.3239.111XX
Samsung S8+Android7.0Firefox51.0XX
Windows 10Windows10Chrome65.0.3325.146XX
Windows 10Windows10Edge14.14393X
Windows 10Windows10Edge15.15063X
Windows 10Windows10Edge16.16299X
Windows 10Windows10Firefox59.0X
Windows 10Windows10IE11.0X
Windows 7Windows7IE10.0
Windows 7Windows7IE11.0X
Windows 8Windows8IE10.0

Example

ASTC

# PVRTexTool - https://community.imgtec.com/developers/powervr/tools/pvrtextool/
# Astcenc - https://github.com/ARM-software/astc-encoder
# Extension - https://www.khronos.org/registry/webgl/extensions/WEBGL_compressed_texture_astc/

# example-astc-4x4
$ node ./bin/texture-compressor -i ./docs/example/example.png -o ./docs/example/example-astc-4x4.ktx -t astc -c astc -b 4x4

# example-astc-8x8
$ node ./bin/texture-compressor -i ./docs/example/example.png -o ./docs/example/example-astc-8x8.ktx -t astc -c astc -b 8x8

ETC

# PVRTexTool - https://community.imgtec.com/developers/powervr/tools/pvrtextool/
# Extension - https://www.khronos.org/registry/webgl/extensions/WEBGL_compressed_texture_etc/

# example-etc1
$ node ./bin/texture-compressor -i ./docs/example/example.png -o ./docs/example/example-etc1.ktx -t etc -c etc1

# example-etc2
$ node ./bin/texture-compressor -i ./docs/example/example.png -o ./docs/example/example-etc2.ktx -t etc -c etc2

# example-etc2A
$ node ./bin/texture-compressor -i ./docs/example/example.png -o ./docs/example/example-etc2A.ktx -t etc -c etc2 -a

PVR

# PVRTexTool - https://community.imgtec.com/developers/powervr/tools/pvrtextool/
# Extension - http://www.khronos.org/registry/webgl/extensions/WEBGL_compressed_texture_pvrtc/

# example-pvrtc2BPP
$ node ./bin/texture-compressor -i ./docs/example/example.png -o ./docs/example/example-pvrtc2BPP.ktx -t pvr -c pvrtc1

# example-pvrtc2BPPA
$ node ./bin/texture-compressor -i ./docs/example/example.png -o ./docs/example/example-pvrtc2BPPA.ktx -t pvr -c pvrtc1 -a

# example-pvrtc4BPP
$ node ./bin/texture-compressor -i ./docs/example/example.png -o ./docs/example/example-pvrtc4BPP.ktx -t pvr -c pvrtc1 -b 4

# example-pvrtc4BPPA
$ node ./bin/texture-compressor -i ./docs/example/example.png -o ./docs/example/example-pvrtc4BPPA.ktx -t pvr -c pvrtc1 -b 4 -a

S3TC

# Crunch - https://code.google.com/archive/p/crunch/
# Extension - http://www.khronos.org/registry/webgl/extensions/WEBGL_compressed_texture_s3tc/

# example-dxt1
$ node ./bin/texture-compressor -i ./docs/example/example.png -o ./docs/example/example-dxt1.ktx -t s3tc -c dxt1

# example-dxt1A
$ node ./bin/texture-compressor -i ./docs/example/example.png -o ./docs/example/example-dxt1A.ktx -t s3tc -c dxt1 -a

# example-dxt3
$ node ./bin/texture-compressor -i ./docs/example/example.png -o ./docs/example/example-dxt3.ktx -t s3tc -c dxt3

# example-dxt5
$ node ./bin/texture-compressor -i ./docs/example/example.png -o ./docs/example/example-dxt5.ktx -t s3tc -c dxt5

Flags

Required

-c, --compression ['astc', 'etc1', 'etc2', 'pvrtc1', 'dxt1', 'dxt3', 'dxt5'] [required]
-i, --input [example: ./docs/example/example.png] [required]
-o, --output [example: ./docs/example/example.ktx] [required]
-t, --type ['astc', 'etc', 'pvr', 's3tc'] [required]

Optional

-b, --bitrate [2.0 - 4.0, default: 2.0 = 8x8 blocksize] [not required]

Or if using ASTC you can optionally change the bitrate for one of the following blocksizes:
[4x4, 5x4, 5x5, 6x5, 6x6, 8x5, 8x6, 8x8, 10x5, 10x6, 10x8, 10x10, 12x10, 12x12] [not required]

-q, --quality [0 - 10, default: 5] [not required]
-a, --alpha [true / false, default: false] [not required]
-m, --mipmap [true / false, default: false] [not required]
-y, --flipY [tue / false, default: false] [not required]

Tool flags

-f, --flags ["flag value" "flag value"] [not required]

To find tool specific flags please refer to the manuals of ASTC, ETC, PVRTC, S3TC.

Licence

My work is released under the MIT licence.

Much has been based on the automated texture compression tool baked into gltf-pipeline.

This repository distributes multiple binary tools for Windows, Mac and Linux.

FAQs

Package last updated on 05 Jul 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc