Difference between revisions of "TI.Image"

From Hackspire
Jump to navigation Jump to search
(External Links)
Line 1: Line 1:
 
The TI.Image format is a type of image used in several places in the Nspire documents, such as Lua scripts.
 
The TI.Image format is a type of image used in several places in the Nspire documents, such as Lua scripts.
  
The image format just some form of bitmap, and almost no compression at all.
+
The format is some form of bitmap, with almost no compression at all.
 +
 
 +
The examples here, as the encoded strings visible in .lua files sometimes show letters and symbols instead of expected "\xxx" characters. This is because the "\xxx" is actually a representation of a non-printable character, and when, by chance, the character is printable the editor displays its value, which can be a letter, a symbol etc.
  
 
==Header==
 
==Header==
Line 11: Line 13:
 
''.\000\000\000\018\000\000\000\000\000\000\000\092\000\000\000\016\000\001\000''
 
''.\000\000\000\018\000\000\000\000\000\000\000\092\000\000\000\016\000\001\000''
  
Currently we know this:
+
We currently know that it is encoded as follow :
 
000\000\000\[Image HEIGHT]\000\000\000\000\000\000\000\[image WIDTH]\000\000\000\[image Depth]\000\001\000
 
000\000\000\[Image HEIGHT]\000\000\000\000\000\000\000\[image WIDTH]\000\000\000\[image Depth]\000\001\000
  
The format of the numbers must be in this form : 000-255
+
The numbers must be between 000 and 255 (00 to FF in hex)
 +
 
 +
We also know that when we change the second triplet of number (in the example above, it would be the first \xxx sequence, because the first characters in the string is printable, as a "." (dot)) from \000 to \001, the image becomes x-repeated and y-shifted for each iteration.
 +
 
 +
Some modifications on other triplets can cause some buffer overflow and segmentation faults errors.
  
 
==Data==
 
==Data==
  
The image data comes directly after the header, and is written in the same form.
+
The image data comes directly after the header, and is written in the same pattern.
 +
 
 +
[image data] can be, for example, \011\022\033\044\055\066\077\088
  
[image data] is for examle \011\022\033\044\055\066\077\088
 
  
If [image height] is \004 and [image width] is \002 then the image looks like this: (each number is a pixel)
+
Let's consider that [image height] is \004 and [image width] is \002.
 +
Then the image looks like this: (each number being a pixel)
  
 
\011 \022
 
\011 \022
Line 29: Line 37:
 
\077 \088
 
\077 \088
  
Each number represents a color.
+
Each number actually represents a color.
 
We are still documenting the color map.
 
We are still documenting the color map.
  
Extra compression:
+
''Extra compression:''
Numbers which are representable in the ascii table (on the nspire) are replaced with the corresponding character. \105 is for example replaced with 'i'. This is not necessary though.  
+
As said previously, numbers which are displayable in the ascii table (on the nspire) are replaced with the corresponding character. \105 is for example replaced with 'i'. This is not necessary though.  
  
 
==External Links==
 
==External Links==

Revision as of 21:29, 21 April 2011

The TI.Image format is a type of image used in several places in the Nspire documents, such as Lua scripts.

The format is some form of bitmap, with almost no compression at all.

The examples here, as the encoded strings visible in .lua files sometimes show letters and symbols instead of expected "\xxx" characters. This is because the "\xxx" is actually a representation of a non-printable character, and when, by chance, the character is printable the editor displays its value, which can be a letter, a symbol etc.

Header

The format has a header specifying the total buffer length. The header is 19 decimal numbers long.

Example header : .\000\000\000\018\000\000\000\000\000\000\000\092\000\000\000\016\000\001\000

We currently know that it is encoded as follow : 000\000\000\[Image HEIGHT]\000\000\000\000\000\000\000\[image WIDTH]\000\000\000\[image Depth]\000\001\000

The numbers must be between 000 and 255 (00 to FF in hex)

We also know that when we change the second triplet of number (in the example above, it would be the first \xxx sequence, because the first characters in the string is printable, as a "." (dot)) from \000 to \001, the image becomes x-repeated and y-shifted for each iteration.

Some modifications on other triplets can cause some buffer overflow and segmentation faults errors.

Data

The image data comes directly after the header, and is written in the same pattern.

[image data] can be, for example, \011\022\033\044\055\066\077\088


Let's consider that [image height] is \004 and [image width] is \002. Then the image looks like this: (each number being a pixel)

\011 \022 \033 \044 \055 \066 \077 \088

Each number actually represents a color. We are still documenting the color map.

Extra compression: As said previously, numbers which are displayable in the ascii table (on the nspire) are replaced with the corresponding character. \105 is for example replaced with 'i'. This is not necessary though.

External Links

User:AdRiWeB made a video showing some direct manipulations of the TI-Image, in order to understand better how the format in general.

User:jimbauwens made a image previewer. You have to paste the image data, and it will display it. Currently only shows the image in grayscale.