All Projects → vthibault → tga.js

vthibault / tga.js

Licence: MIT license
Load and display TGA files with Javascript.

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to tga.js

imageformats
Library for decoding obscure graphics formats, such as Targa (.TGA), Sun raster (.RAS, .SUN), ZSoft (.PCX), Netpbm (.PPM, .PGM, .PBM, .PNM), Amiga (LBM, PIC), SGI, MacPaint, and DICOM.
Stars: ✭ 21 (-43.24%)
Mutual labels:  tga
War3Net
A .NET implementation of Warcraft III related libraries.
Stars: ✭ 76 (+105.41%)
Mutual labels:  tga
stbi-sharp
C# wrapper around stb_image.h and qoi.h
Stars: ✭ 17 (-54.05%)
Mutual labels:  tga
EnvMapTooL
No description or website provided.
Stars: ✭ 25 (-32.43%)
Mutual labels:  tga
sail
The missing small and fast image decoding library for humans (not for machines) ⛵ https://sail.software
Stars: ✭ 206 (+456.76%)
Mutual labels:  tga
StbSharp
C# port of the famous C framework
Stars: ✭ 62 (+67.57%)
Mutual labels:  tga

tga-js

Browser License: MIT

tga-js is a tga file loader written in JavaScript, working in the browser environment. It provides a simple and really fast solution for loading TGA file format.

Lot of games are using TGA files to store textures. So, since browsers try to bring games in the web it can be a good idea to have a TGA loader (actually a better idea to use another smaller file format).


🔗 Used by :


🚀 Installation

Install with yarn:

$ yarn add tga-js

Or install using npm:

$ npm i tga-js

📖 Usage

Loading a remote tga file.

import TgaLoader from 'tga-js';

const tga = new TgaLoader();
tga.open('./assets/resource.tga', () => {
  document.body.appendChild(tga.getCanvas());
});

Loading a tga from buffer.

import TgaLoader from 'tga-js';

const tga = new TgaLoader();

// Your own function returning a buffer from cache/memory/..
const buffer = getImageBufferFromCache('resource/data');

tga.load(new UInt8Array(buffer));
document.body.appendChild(tga.getCanvas());

Get data-uri as output

tga.getDataURL('image/png');
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].