#!F-adobe-helvetica-medium-r-normal--18*
#!N 
#!CDarkGreen #!N  #!Rex10 
Example 12. Image Files #!N #!EC #!N #!N This Data Explorer 
header file reads an image (  #!F-adobe-times-bold-r-normal--18*   cylinder.rgb #!EF ). The 
image is 350 x 300 and consists of RGB colors (3-vectors). 
You can read this image in, and display it, using the 
visual program  #!F-adobe-times-bold-r-normal--18*   /usr/local/dx/samples/programs/ReadImage.net #!EF . This file can be found 
in  #!F-adobe-times-bold-r-normal--18*   /usr/local/dx/samples/data/image.dx #!EF . #!N Note: It is easier to 
import a file in the RGB format by using the ReadImage 
module. This example illustrates the different aspects of header files. #!N 
#!CForestGreen #!N #!N  #!F-adobe-courier-bold-r-normal--18*   #!N # First describe the positions. The 
image is written such that #!N # x varies fastest, and 
the first pixel in the file is the one that is 
#!N # to be displayed at the top left. #!N # 
Because x varies fastest, the last delta specifies a vector in 
#!N # the x direction. Because the first pixel is at 
the top left, #!N # the delta in the y direction 
is -1. #!N object 1 class gridpositions 300 350 #!T,43,69 #!N 
origin TAB 0 TAB 0 #!N delta TAB 0 TAB -1 
#!N delta TAB 1 TAB 0 #!EF #!N #!N #!EC #!CForestGreen 
#!N #!N  #!F-adobe-courier-bold-r-normal--18*   #!N # Next describe the connections #!N # 
The image is 350 pixels in x and 300 pixels in 
y. Since #!N # x is the last delta specified, the 
connections are specified as #!N # 300 x 350 #!N object 
2 class gridconnections 300 350 #!N attribute "ref" string "positions" #!N 
attribute "element type" string "quads" #!EF #!N #!N #!EC #!CForestGreen #!N 
#!N  #!F-adobe-courier-bold-r-normal--18*   #!N # Next indicate that the data can be 
found in the file "cylinder.rgb", #!N # starting at byte 0. 
There are three bytes (red, green, and blue) #!N # for 
each pixel. #!N object 3 class array type byte rank 1 
shape 3 ieee msb items 105000 #!N data file cylinder.rgb,0 #!N 
attribute "dep" string "positions" #!EF #!N #!N #!EC #!CForestGreen #!N #!N 
 #!F-adobe-courier-bold-r-normal--18*   #!N # We read the colors in as the "data" 
component. This allows us #!N # to immediately begin operating on 
them (for example, to convert the #!N # bytes to floating 
point colors) #!N object "image" class field #!N component "positions" 1 
#!N component "connections" 2 #!N component "data" 3 #!EF #!N #!N 
#!EC #!N #!N #!N  #!F-adobe-times-medium-i-normal--18*   Next Topic #!EF #!N #!N  #!Lsynff,dxall638 h Syntax of the Native File Format  #!EL  
#!N  #!F-adobe-times-medium-i-normal--18*   #!N 
