ReadImage sFilename,aPalette,startX,startY[,bUseTransparency][,iFramesCount]
The image palette, returned by function, can be not matched to real image colors. This depends on the file structure and subformats. Moreover, the palette information can be absent in the image file. To get the proper resulting output image in the end of the script job you should either save the image into true color format (JPEG or true color PNG) or use WebPalette, BuildPalette or ApplyPalette just before creating GIF image or paletted PNG.
Vector (WMF) images
The function can read WMF files only if the AdvancedCheck
property is set to True. The VectorSizeX and
VectorSizeY properties also affect the vector
image drawing.
Multipaged TIFF images
By default, the ReadImage reads the first page of TIFF image. In case if TIFF image
contains two or more pages then you can instruct the method to read specified page. Call the
SetInstantParameter method passing two parameters: the "TiffFrameNumber" string and
zero-based frame number. The value will be set before the ReadImage call, after that it will
be reset to zero again. Therefore, if you want to call the ReadImage with different frame numbers
several times one after another then you should call the SetInstantParameter before
every ReadImage call:
g.SetInstantParameter "TiffFrameNumber",4
g.ReadImage tiff_file,palette,0,0
Possible data types for 'sFileName' parameter
| Data type | Means |
| String | Path to file. The image will be read from that file. |
| Safearray | Image into safearray. The image will be read from safearray. |
| ShotGraph object | The image will be read from active imagespace of other ShotGraph object. |
filename="d:\dragon.gif"
set obj=CreateObject("shotgraph.image")
obj.GetFileDimensions filename,xsize,ysize
obj.CreateImage xsize,ysize,256
obj.SetColor 0,255,255,204
obj.SetColor 1,255,51,51
obj.SetBgColor 0
obj.FillRect 0,0,xsize,ysize
obj.CreatePen "PS_SOLID",2,1
obj.SetTextColor 1
obj.SetBkMode "TRANSPARENT"
obj.CreateFont "Arial",204,56,0,True,False,False,False
obj.SetTextAlign "TA_LEFT","TA_TOP"
obj.TextOut 20,10,"String 1"
obj.SetTextAlign "TA_RIGHT","TA_BOTTOM"
obj.TextOut xsize-20,ysize-10,"String 2"
obj.Line 0,ysize-1,xsize-1,0
obj.ReadImage filename,pal,0,0
obj.BuildPalette 2
obj.GifImage -1,0,"d:\test.gif"
Result:
![]() ![]() ![]() ![]() |
The second script is similar the previous one except the dragon GIF image is read before drawing text strings and line
filename="d:\dragon.gif"
set obj=CreateObject("shotgraph.image")
obj.GetFileDimensions filename,xsize,ysize
obj.CreateImage xsize,ysize,256
obj.SetColor 0,255,255,204
obj.SetColor 1,255,51,51
obj.SetBgColor 0
obj.FillRect 0,0,xsize,ysize
obj.CreatePen "PS_SOLID",2,1
obj.SetTextColor 1
obj.ReadImage filename,pal,0,0
obj.SetBkMode "TRANSPARENT"
obj.CreateFont "Arial",204,56,0,True,False,False,False
obj.SetTextAlign "TA_LEFT","TA_TOP"
obj.TextOut 20,10,"String 1"
obj.SetTextAlign "TA_RIGHT","TA_BOTTOM"
obj.TextOut xsize-20,ysize-10,"String 2"
obj.Line 0,ysize-1,xsize-1,0
obj.BuildPalette 2
obj.GifImage -1,0,"d:\test.gif"
Result:
![]() ![]() ![]() ![]() |