Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (791)
Games in Android Showcase (234)
games submitted by our members
Games in WIP (864)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  TGA Decoder  (Read 5805 times)
0 Members and 1 Guest are viewing this topic.
Offline Neoptolemus
« Posted 2015-02-22 23:14:31 »

Hi all,

I've been using the TWL PNGDecoder quite regularly but couldn't find a comparable decoder for TGA images which I use sometimes, so I thought I'd have a go at writing one. I've written it to work in the same way as the PNGDecoder (create a new decoder object with an input stream, then call decode and supply a bytebuffer). You can find it here:

It supports 24-bit (RGB) and 32-bit (RGBA) formats, and uncompressed or RLE Compressed formats. On my 2.7ghz i7 it took 180ms to decode a 40mb compressed 2988×5312x24 photo and around 80ms to decode a 15mb compressed 2048x2048x32 image. Uncompressed images take around half that time.

Hope someone finds this helpful!
Offline Sickan
« Reply #1 - Posted 2015-02-22 23:28:34 »

Great! These things are sorely lacking from Java and interfacing with native libraries is a pain.
Offline basil_

« JGO Bitwise Duke »

Medals: 418
Exp: 13 years

« Reply #2 - Posted 2015-02-22 23:39:58 »

yes, thanks for sharing Smiley
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Neoptolemus
« Reply #3 - Posted 2015-02-23 05:46:30 »

You're welcome, guys! If there is enough demand for it then I'll look at adding support for 16-bit and colour-mapped images, but since I don't use them myself I haven't bothered yet.
Offline HeroesGraveDev

JGO Kernel

Medals: 382
Projects: 11
Exp: 4 years

┬─┬ノ(ಠ_ಠノ)(╯°□°)╯︵ ┻━┻

« Reply #4 - Posted 2015-02-23 06:04:28 »

What license is it under?

I'd love to include it in Spade. We've had this issue open for a while now.

Offline Neoptolemus
« Reply #5 - Posted 2015-02-23 09:55:54 »

What license is it under?

I'd love to include it in Spade. We've had this issue open for a while now.

Oops, forgot to modify the header. I've put it under the MIT license, so feel free to integrate it any way you like, or extend/modify (fix?) parts.

If you're looking to implement it as part of an image editing program, you'll probably want to include support for at least 16-bit and colour-mapped file formats as well. I will take a look since I'm going to use this as part of my 3D game engine. I only restricted the file formats because right at the moment I'm just using it to import some textures to test my FBX binary parser (turns out the UVs are a bit dodgy Sad), but eventually I'll want to include as wide a media support as possible.

PS: Took a look at your Spade project, I like the idea Smiley Do you have a custom JPEG importer at all? I did some research and it looks pretty horrendous (at least compared to the relatively-straightforward TGA format). Then again, the compression on JPEGs is far more aggressive than on TGAs so I guess it's not unexpected that it would be more complicated to uncompress.

For the moment, I used this technique as a quick fix to decode JPEG images:

Eventually I'll write my own and package it up with the TGA decoder.
Offline ziozio
« Reply #6 - Posted 2015-02-24 10:47:31 »

What license is it under?

I'd love to include it in Spade. We've had this issue open for a while now.

@HeroesGraveDev I noticed you were using ImageIO in Spade, this library here (not me but I have used it) has some good image plugins for ImageIO and is actively developed. You might find it useful.
Pages: [1]
  ignore  |  Print  

hadezbladez (2895 views)
2018-11-16 13:46:03

hadezbladez (1046 views)
2018-11-16 13:41:33

hadezbladez (2846 views)
2018-11-16 13:35:35

hadezbladez (560 views)
2018-11-16 13:32:03

EgonOlsen (3839 views)
2018-06-10 19:43:48

EgonOlsen (4256 views)
2018-06-10 19:43:44

EgonOlsen (2552 views)
2018-06-10 19:43:20

DesertCoockie (3367 views)
2018-05-13 18:23:11

nelsongames (3481 views)
2018-04-24 18:15:36

nelsongames (4492 views)
2018-04-24 18:14:32
Java Gaming Resources
by philfrei
2019-05-14 16:15:13

Deployment and Packaging
by philfrei
2019-05-08 15:15:36

Deployment and Packaging
by philfrei
2019-05-08 15:13:34

Deployment and Packaging
by philfrei
2019-02-17 20:25:53

Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!