I’ve recenlty made another tool for working with textures. This time it’s an application that is able to load textures (or images) from any kind of a file. Basically you provide offset in the file, width and height of the image and decoding algorithm (DXT1/3/5, RGB, ARGB, A, AG …). The application will then try to allocate appropriate bitmap and decodes file’s content into the bitmap using selected decoder.
This may be very useless for an ordinary user, but if you want to analyze files and see if they contain any images, it can become very handy. Just imagine my situation a few months ago when I was about to create an application that could load and display Call of Duty’s IWI files. Before I could start doing anything, I had to know the structure of the IWI files. So I was searching the internet for some specifications, but found nothing. So I just had to open the IWI files in a HEX editor and do a detective job to find out what an ordinary IWI file consists of. Thats why I developed predecessor of this texture analyzer, it was called DXTViewer (I think it ships with IWI Viewer files).
Anyway, this new application doesn’t support just viewing the images, you can also simulate loading of the image headers (or any structural data if you want). After you specify the structure, TextureAnalyzer will let you deserialize the structure from a file at any given offset.
To open an image:
- Go to File > Open or click the folder icon in the toolbar
- Provide the file name, offset, width, height and decoder in the Open file dialog. See Supported decoders for further info on decoders and how they decode the image.
To work with an image:
- Right-click on the image in the workspace window (if you don’t see the workspace window, go to View > Workspace
- Select an option from the menu
- View – activates the image window
- Export – allows you to export the image in various formats
- Open * – shows the Open file dialog with predefined file name and other parameters (except for the “Deserialize structure”, this option will open the Deserialize dialog with predefined file name and offset)
- Show size calculator – opens the Calculate image size dialog
- Close – this will close the image. The file itself will remain in workspace until you remove it (righ click on the file and select Remove)
To create and deserialize structure:
- In the Structures window (if you don’t see this window, go to View > Structures) click on the first icon from the left
- In the New structure dialog, provide a name for the structure
- Right click on the structure, go to Add and select a appropriate data type. When adding a Char array, Wide char array and Non string char array, you will have to specify the size of the data array, otherwise you will be asked only for the name of the new field.
- To deserialize structure, right click on it and select Deserialize from the menu. The Deserialize dialog will open, specify the file name and the offset.
A field with the blue tag represents numeric type, the red tag represents string type. Wide char array and Wide string use wchar_t as a representation of a single character. String and Wide string do not need a size to be specified. The total size of the field is determined when a null-terminating character is found. Non char array is the same data type as Char array except when deserializing the structure, you will see the HEX bytes delimited by a whitespace instead of a string. You cannot change the data type of the field or rename the field. Instead, remove the field by clicking on the first icon from the right in Structures window, then add a new field and move it up if necessary.
To change the size and colors of the grid, you have to manually edit the config.ini file. This file can be found in the application’s directory. The default settings are:
Please note that the decoder’s name defines the byteorder in which are the images decoded (except DXTn). For example R8G8B8 (or RGB for short) expects the input file to have pixels stored in R-G-B order, that is, first byte for R, second for G and third for B whereas for B8G8R8 (RGB but reversed byteorder) is first byte for B, second for G and third for R.
- B8G8R8 – 24 bits per pixel, reversed RGB byteorder
- R8G8B8 – 24 bits per pixel, RGB byteorder
- B8G8R8A8 – 32 bits per pixel, reversed RGB byteorder + alpha channel at the fourth byte
- R8G8B8A8 – 32 bits per pixel, RGB byteorder + alpha channel at the fourth byte
- A8B8G8R8 – 32 bits per pixel, reversed RGB byteorder + alpha channel at the first byte
- A8R8G8B8 – 32 bits per pixel, RGB byteorder + alpha channel at the first byte
- A8 – 8 bits per pixel, alpha channel only
- A8+Grayscale – 16 bits per pixel, alpha channel and grayscale byte
- Grayscale+A8 – 16 bits per pixel, grayscale byte and alpha channel
- DXTn – Image compressed using S3TC algorithm, current version supports DXT1,DXT3,DXT5
Texture Analyzer requires Microsoft Visual C++ 2010 Redistributable Package (x86) (You may already have this package installed (check in Control Panel))
This application is built for x86 platform, if you need x64 application, send me an email and I’ll build it for you.