I each time get errors when I use an .bmp or ,.gif file as source but
whenever I use a .jpg file it works perfect.
Why is that? and how to fix it?
I almost have no knowledge about the system.drawing and so I am in the dark
about this.
This is my code
----------------------------------
<%@ Page Language="vb" %>
<%@ import namespace="system.drawing" %>
<%@ import namespace="system.drawing.imaging" %>
<%@ import namespace="system.drawing.drawing2d" %>
<%
' initialise objects
dim strFilename as string
dim b as New System.Drawing.Bitmap(server.mappath("test.jpg"))
dim g as graphics = graphics.fromimage(b)
g.smoothingMode = smoothingMode.antiAlias
dim stringFormat As New StringFormat()
g.drawString("The Magic Word", New font("arial",3),systembrushes.windowtext,
New pointF(2,2), stringFormat)
' Set the content type
response.contenttype="image/jpeg"
' send the image to the viewer
b.save(response.outputstream, b.rawformat)
' tidy up
b.dispose()
%>