var CharLoc:integer; {Global variable, initially zero} macro 'Import Image R-AXIS FileÉ'; { Based on "Import Image TIFF File". } var width,height,offset:integer; begin width:=1024; height:=1; offset:=0; SetImport('8-bit; Swap'); SetCustom(width,height,offset); Import(''); {Read in header as an image, prompting for the file name.} if not (GetPixel(0,0)=82) then begin {'R'} PutMessage('This is not a R-Axis file.'); SelectPic(nPics); Dispose; exit; end; offset := (GetPixel(784,0)*256*256*256) + (GetPixel(785,0)*256*256) + (GetPixel(786,0)*256) + GetPixel(787,0); if not ((offset>0) and (offset<65536)) then offset := (GetPixel(787,0)*256*256*256) + (GetPixel(786,0)*256*256) + (GetPixel(785,0)*256) + GetPixel(784,0); width := offset/2; height := (GetPixel(788,0)*256*256*256) + (GetPixel(789,0)*256*256) + (GetPixel(790,0)*256) + GetPixel(791,0); if not ((height>0) and (height<65536)) then height := (GetPixel(791,0)*256*256*256) + (GetPixel(790,0)*256*256) + (GetPixel(789,0)*256) + GetPixel(788,0); SelectPic(nPics); {The ID of the last window opened is equal to nPics.} Dispose; SetImport('16-bit Unsigned; Invert; Swap'); SetCustom(width,height,offset); Import(''); {No prompt this time; Import remembers the name.} FlipVertical; end;