PngImage
The PngImage method writes the whole image or its part to PNG format.
PngImage
vTransparent, vColorMode, sFileName [,nXStart] [,nYStart] [,Width] [,Height]
Parameters
-
vTransparent
-
Specifies the transparent color number in the image (from colors earlier defined by SetColor).
If you want your image to have no transparent color, set this value to -1.
-
vColorMode
-
Specifies whether PNG file will be true color image (0) or paletted image (1).
-
sFileName
-
String specifying the name of the file to write to. If sFileName is
a zero length string, the resulting PNG image will be produces as SAFEARRAY
return value. You can use this for generation of images with ASP and
sending them to client instead of writing to file.
-
nXStart
-
Specifies the x-coordinate of the first base corner of the bounding rectangle
-
nYStart
-
Specifies the y-coordinate of the first base corner of the bounding rectangle
-
Width
-
Specifies the width of image bounding rectangle
-
Height
-
Specifies the height of image bounding rectangle
Return Value
This method returns binary PNG image, if sFileName parameter is
zero length string.
Remarks
For generation of images with ASP on the fly and
sending them to client use BinaryWrite
method of Response object.
If you have not specified the image sizes, the whole image in the primary imagespace will be
used to create PNG.
If you create paletted PNG file you may want to call the BuildPalette or
ApplyPalette methods just before PngImage in cases when real image colors
don't match colors declared by SetColor calls.
Example
<%
Response.ContentType = "image/png"
Set g = CreateObject("shotgraph.image")
g.CreateImage 320,240,8
...............
' Create true color PNG image
Response.BinaryWrite g.PngImage(-1,0,"")
%>