Example: How Images use Tiles from Tables

The data for an image imported from a .jpg file can be stored in a table in the form of tiles of uint8x3 values, which are x3 tuples of unsigned eight bit integers, a typical way of representing RGB colors.   


In this example we import a small .jpg image called bronze.jpg into our project.  The result is an image component called bronze and a table called bronze Tiles.  


We can double-click on the image and on the table to open them.  




The image shows a bronze statue.   




The table has a field called Tile which has data of type tile for each record.  It is a small table since the image is small.


If we right click on the bronze image component in the Project pane and choose Properties we can see that the image takes its content from the table called bronze Tiles using the field called Tile as the source of the tiles.  




Those properties are editable so if we like we can change them to use other fields or to use other tables.


For example, we can copy the bronze Tiles  table, paste it and then rename the pasted copy bronze Tiles 2.




We open the bronze Tiles 2 table we can Ctrl-click on the row handle for the second record to select it.   We then press the Delete key to delete the selected record.   




We now open the Properties for the bronze image and we edit the value in the Table property to be the bronze Tiles 2 table.    We press Enter to accept the edit and then OK.




We press OK to exit the Properties dialog.   To refresh the image we close it and then open it again.  We see that the image now has a rectangular region missing because the tile for that region was deleted from the bronze Tiles 2 table.



This particular example is a clumsy, not-quite-right way of messing with a table that provides tiles for an image.  For example, images normally refresh automatically with no need to close them and re-open them.  We have to do that in this case because we have manually broken the machinery of images: there is  logical inconsistency to just deleting a tile so all of the tiles required for the image are not present.   It is a tribute to the robustness of images that the image did not simply choke on that inconsistency.    But deleting the tile is still useful as a "quick and dirty" example of how images are just a means of visual display for data that is stored as tiles in a table.


This example continues in the Example: An Image using Computed Fields in a Table topic.


See Also



Images and Channels


Palette Images




Style: Presenting Images


Style: Autocontrast


Style: Palettes




Example: Create Two Images From One Table - More than one image can show data from the same table, including from the same tile field.


Example: An Image using Computed Fields in a Table - How an image can be created from tiles where the data for the tiles is taken from a field that is computed on the fly.


SQL Example: Re-tile an Image using a Different Tile Size - Starting with an image that uses a tile size of 128 x 128 pixels this SQL example creates a copy of the image using 500 x 500 pixel tiles.