TGA 文件解析
来源:互联网 发布:什么是linux串口编程 编辑:程序博客网 时间:2024/05/16 05:15
TGA File Format
A .tga file is commonly used graphic file format that is easy to read and write.
Format Notes
- TGA files support 8,15,16,24,32 bit depths.
- 8 bit can be grey scale
- Runlength compression
- Additional Footer information optional x/y origin relative to lower left with origin in lower left
- descriptor: 00vhaaaa
- h horizontal flip
- v vertical flip
- a alpha bits
File Header (18 bytes)
typedef struct
{
byte identsize; // size of ID field that follows 18 byte header (0 usually)
byte colourmaptype; // type of colour map 0=none, 1=has palette
byte imagetype; // type of image 0=none,1=indexed,2=rgb, 3=grey,+8=rle packed
short colourmapstart; // first colour map entry in palette
short colourmaplength; // number of colours in palette
byte colourmapbits; // number of bits per palette entry 15,16,24,32
short xstart; // image x origin
short ystart; // image y origin
short width; // image width in pixels
short height; // image height in pixels
byte bits; // image bits per pixel 8,16,24,32
byte descriptor; // image descriptor bits (vh flip bits)
// pixel data follows header
} TGA_HEADER
Example File Header
Here is the header of a 32 bit image with dimensions 1920x1080. Note that these hex rows are 18 bytes so the entire TGA header is on the top row. Also notice that even though the columapbits is set to 32 the bits is set to 24, thus the pixel data is actually 24 bpp.
00000000 00 00 02 00 00 00 00 20 00 00 00 00 80 07 38 04 18 00 ....... ......8...
00000018 31 52 41 18 52 10 10 6A 18 31 6A 5A 39 73 5A 41 73 6A 1RA.R..j.1jZ9sZAsj
00000036 52 73 7B 52 73 9C 39 5A 7B 31 4A 6A 31 4A 73 41 6A 94 Rs{Rs.9Z{1Jj1JsAj.
00000054 52 73 A4 29 20 18 20 18 10 10 10 10 18 18 18 29 29 29 Rs.) . ........)))
00000072 20 29 29 29 31 31 29 31 31 29 39 39 39 39 39 31 31 39 )))11)11)99999119
00000090 20 31 31 39 39 39 31 41 41 31 39 41 31 39 39 31 39 39 119991AA19A199199
后记:
TGA是一种图片格式,使用工具ACDSee或者photoshop都可以打开,也可以另存为tga后缀的文件。
一般去掉18 bytes的文件头,就是数据内容。使用UE可以比较,数据内容都是一模一样的。
详细格式可参考以下网址:
http://en.wikipedia.org/wiki/Truevision_TGA
TGA spec请参考如下网址:
http://www.dca.fee.unicamp.br/~martino/disciplinas/ea978/tgaffs.pdf
- tga文件解析
- TGA 文件解析
- C# 解析 Targa文件 (TGA) 图形
- TGA文件类
- C++读写Tga文件
- 读写TGA文件
- 解析BMP GIF JPEG TGA PNG图像格式
- 解析BMP GIF JPEG TGA PNG图像格式
- Part 10 使用TGA文件作为纹理
- 一个读取tga文件的类
- OpenGLES加载tga文件为纹理
- NeHe OpenGL第三十三课:TGA文件
- TGA文件内部格式详解(转)
- 使用TGA文件作为纹理(转 Phil.Z)
- 自己编写一个读取TGA文件的类
- [转载]TGA文件内部格式及程序实现
- tga文件格式
- tga资源
- VC6.0不是装在C盘下出现的问题
- VM下安裝ubuntu10.04的详细图文笔记
- Android 中tomcat搭建本地服务器 实现apk更新下载
- ActionContext.getContext()的用法心得
- C++继承:公有,私有,保护
- TGA 文件解析
- sql统计列重复次数
- Android如何防止apk程序被反编译
- HTML大于与小于,空格
- 部署Qianbao到Heroku时遇到的一些问题
- java中XML格式的字符串4读取方式的简单比较
- 电商创业的五大新模式
- 批量替换文件名和内容的Python脚本
- 图片热点的使用,html <area> 的用法