Archived

This topic is now archived and is closed to further replies.

idinkin

Alpha channel

Recommended Posts

Well, there's TGAs, but they generally aren't compressed. There is compression available for the format, but I've never used it.

There's also multiple 3rd party utilities available for converting files to DXTC formats.

[edited by - Ostsol on October 24, 2003 1:51:50 PM]

Share this post


Link to post
Share on other sites
I like TGA''s. I have a tga loader that can read 16, 24 and 32 bit uncompressed RGB(A), and 16, 24 and 32 bit RLE images. The RLE works really well if you have an image that uses alot of the same color in a row (it stores it in a value, with a count of how many times to repeat it). If you have a photograph type image though, RLE sucks, because you have to have the packet to tell you how many to repeat, and if it is only one (a raw packet), then you might even increase the size of your file. For stuff you make in photoshop though, it''ll probably be sufficient.

I''ve heard good things about PNG files as well. They have lossless compression (unlike JPEG and the like), and they support having an alpha channel. I''ve never tried PNG''s yet, but you might look into it. It even has its own libraries (I think you have to get zlib and libpng).

Share this post


Link to post
Share on other sites
I made my own ".tex" format: 1 dword header, 3 ints - width, height, numchannels + data



[ My Site ]

Member of "Un-Ban nes8bit" association (UNA) (to join put this in your sig) (Welcome back to JesperT)
Founding member of "Dave Astle is an ALIEN god" association (DAIAAGA) (proof here)(to join put this in your sig and praise Dave daily)
/*ilici*/

Share this post


Link to post
Share on other sites
quote:
Original post by idinkin
How do you think what is the smallest/normal quality format for gray scale images?


Gray scale images are obviously 8 bit images...the best format is GIF!! Unfortunately It''s licensed and it is hard (and illegal I suppose)to get source/library to use them. Fortunately GIF are based on an algorithm similar to zlib so you can use this lib to compress data (without losses).
Of course you should create an header of your own...another solution is to use BMP (without compression).

Share this post


Link to post
Share on other sites
quote:
Original post by blizzard999
quote:
Original post by idinkin
How do you think what is the smallest/normal quality format for gray scale images?


Gray scale images are obviously 8 bit images...the best format is GIF!! Unfortunately It''s licensed and it is hard (and illegal I suppose)to get source/library to use them. Fortunately GIF are based on an algorithm similar to zlib so you can use this lib to compress data (without losses).
Of course you should create an header of your own...another solution is to use BMP (without compression).




PNG is supposedly the better alternative to gif, especially with the liscensing issues. They also corrected and added some features that gif didn''t.

Share this post


Link to post
Share on other sites
Just my two cents.

PNG has a similar licence as ZLib ((g)zip files). The compression is very similar (almost the same actually). As they say at the ZLib page (www.zlib.org):
quote:
If this page seems suspiciously similar to the PNG Home Page, rest assured that the similarity is completely coincidental. No, really.



And there is no data loss with zip files, so also none at png files.

This is the png site:
http://www.libpng.org/pub/png/


Creator of: Science Fiction Career
Percent finnished: 0.1%

Site: comming soon
Forum: comming soon

Share this post


Link to post
Share on other sites
BMP and TGA are the best formats for 32-bit RGBA images availiable in Photoshop. However compressed textures won''t be stored compressed in VRAM after loaded (as long as you don''t convert it to compressable format), they will only save HDD space. However using DXT1/3/5 compression is a very good way of storing compressed textures in VRAM and gain some performance.



Member of the Shove Pouya Off A Cliff club, SPOAC. (If you wish to join, add this line to your signature.)
Member of "Un-Ban nes8bit" association, UNA (to join put this in your sig)

"C lets you shoot yourself in the foot rather easily. C++ allows you to reuse the bullet!"

Share this post


Link to post
Share on other sites
quote:
Original post by idinkin
I just need a loseless compression for an 8 bit image (With smallest size able). What is the best option?

2mldaalder: PNG allows 16 bit grayscale only... I need 8 bit.


Try TGA then. TGA uses 8 bit grayscale images (i would''ve thought sure PNG would have as well). If you''re just loading them for your own use, and you need to display them as 8 bit, you could always decode the PNG but add (PixelValue >> 3) to the equation to align it with 8 bits.

Share this post


Link to post
Share on other sites
quote:
Original post by idinkin
2mldaalder: PNG allows 16 bit grayscale only... I need 8 bit.

PNG supports grayscale images with bit depths of 1, 2, 4, 8, or 16. PNG also support grayscale-with-alpha images with bit depths of 8 and 16. This is straight from the documentation.

The input transformations of libpng allow you to have it modify the bit depth of images as they''re loaded in certain ways, so it often doesn''t even really matter what the file is actually storing.

TIFF also supports a lot of grayscale formats, if you want an even more complex file format.

Share this post


Link to post
Share on other sites
I have found TGA compression to be rather weak. It''s good when most of the data is the same and in sequential order, but it''s completely useless for most other things. I plan on writing a PNG loader later.

Share this post


Link to post
Share on other sites