Create Jpeg/Png programatically?

  • Thread starter Thread starter Mark B
  • Start date Start date
M

Mark B

I want to display a pre-designed graphical 'performance badge' on certain
webpages (round, about 2cm diameter) next to a salesperson's details.

I have a function, fGetPerformanceGrade(SalesPersonID as Long) as String to
retrieve that salesperson's grade (e.g. A+, A, A-, B+, B... D). Also one
other function, fGetMonthlySales(SalesPersonID as Long) as String to get
their sales figure, e.g. "$87K".

I want web visitors to be able to click the badge to then be redirected to a
sales low-level detail page.

I want the performance badge to include the two figures inside it.

I want the whole badge to be clickable so I am guessing the results of the
functions can't be text else the cursor will appear when people click on the
badge.

My thought then is that the badge needs to be constructed programmically at
run-time to incorporate those figures as pictures, or better still as part
of the overall graphic.

How would I do this? (I am a bit of a newbie to VB.NET)

Thanks very much in advance.
 
Hello Mark,

As Cor suggested, we can
1. Create a Bitmap object
'Create Bitmap object of specific width and height
Dim Img As New Bitmap(intWidth, intHeight)

2. Create the Graphics object using the Bitmap object
'Obtain Graphics object to perform graphics opration
Dim g As Graphics = Graphics.FromImage(Img)

3. Use the DrawString() method of the Graphics class to draw the figures in
the badge
'Use drawString method of the graphics object to write text on target bitmap
g.DrawString("Test", New Font("Arial", 15, FontStyle.Bold), _
New SolidBrush(Color.Red), 25, 35)

4. Save the image to a temporary directory:
'Save this bitmap using its save method as .Tiff,.jpg or any other image
ImgStamp.Save(YourPath &
"\MyStamp.jpg",System.Drawing.Imaging.ImageFormat.Jpg))

After then, display the image in your page.

Regards,
Jialiang Ge ([email protected], remove 'online.')
Microsoft Online Community Support

=================================================
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

This posting is provided "AS IS" with no warranties, and confers no rights.
=================================================
 
An error message shows when I try and execute that code: "A generic error
occurred in GDI+. "

Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Runtime.InteropServices.ExternalException: A
generic error occurred in GDI+.

Source Error:

Line 73: <td rowspan="2">g
Line 74:
Line 75: <% =SharedFunctions.fDisplayBadge("28K", "B+")
Line 76:
Line 77:

Source File: C:\Users\Mark\Documents\Visual Studio
2008\WebSites\LocalWeb\pages\verify\group\default.aspx Line: 75

Stack Trace:

[ExternalException (0x80004005): A generic error occurred in GDI+.]
System.Drawing.Image.Save(String filename, ImageCodecInfo encoder,
EncoderParameters encoderParams) +397778
System.Drawing.Image.Save(String filename, ImageFormat format) +69
SharedFunctions.fDisplayBadge(String strDot, String strGrade) +178
ASP.pages_verify_group_default_aspx.__Render__control1(HtmlTextWriter
__w, Control parameterContainer) in C:\Users\Mark\Documents\Visual Studio
2008\WebSites\LocalWeb\pages\verify\group\default.aspx:75
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer,
ICollection children) +98
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +20
System.Web.UI.Page.Render(HtmlTextWriter writer) +26
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer,
ControlAdapter adapter) +25
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter
adapter) +121
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +22
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2558

--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.1433;
ASP.NET Version:2.0.50727.1433


The code I used was:

<% =SharedFunctions.fDisplayBadge("28K", "B+") %>

in an aspx page and:

Shared Function fDisplayBadge(ByVal strDot As String, ByVal strGrade As
String) As Object

Dim Img As New Bitmap(100, 100)
Dim g As Graphics = Graphics.FromImage(Img)
g.DrawString("Test", New Font("Arial", 15, FontStyle.Bold), _
New SolidBrush(Color.Red), 25, 35)
Img.Save("C:\MyStamp.jpg", System.Drawing.Imaging.ImageFormat.Jpeg)

End Function
 
It is because the source stream was closed before we save it.
You may have a look at this KB article
http://support.microsoft.com/kb/814675/en-us
or this thread that I once handled:
http://www.microsoft.com/communitie...884-86b1-fc3ec838cba4&lang=en&cr=us&sloc=&p=1

Regards,
Jialiang Ge ([email protected], remove 'online.')
Microsoft Online Community Support

=================================================
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

This posting is provided "AS IS" with no warranties, and confers no rights.
=================================================


Mark B said:
An error message shows when I try and execute that code: "A generic error
occurred in GDI+. "

Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Runtime.InteropServices.ExternalException: A
generic error occurred in GDI+.

Source Error:

Line 73: <td rowspan="2">g
Line 74:
Line 75: <% =SharedFunctions.fDisplayBadge("28K", "B+")
Line 76:
Line 77:

Source File: C:\Users\Mark\Documents\Visual Studio
2008\WebSites\LocalWeb\pages\verify\group\default.aspx Line: 75

Stack Trace:

[ExternalException (0x80004005): A generic error occurred in GDI+.]
System.Drawing.Image.Save(String filename, ImageCodecInfo encoder,
EncoderParameters encoderParams) +397778
System.Drawing.Image.Save(String filename, ImageFormat format) +69
SharedFunctions.fDisplayBadge(String strDot, String strGrade) +178
ASP.pages_verify_group_default_aspx.__Render__control1(HtmlTextWriter
__w, Control parameterContainer) in C:\Users\Mark\Documents\Visual Studio
2008\WebSites\LocalWeb\pages\verify\group\default.aspx:75
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer,
ICollection children) +98
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +20
System.Web.UI.Page.Render(HtmlTextWriter writer) +26
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer,
ControlAdapter adapter) +25
System.Web.UI.Control.RenderControl(HtmlTextWriter writer,
ControlAdapter adapter) +121
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +22
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2558

--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.1433;
ASP.NET Version:2.0.50727.1433


The code I used was:

<% =SharedFunctions.fDisplayBadge("28K", "B+") %>

in an aspx page and:

Shared Function fDisplayBadge(ByVal strDot As String, ByVal strGrade As
String) As Object

Dim Img As New Bitmap(100, 100)
Dim g As Graphics = Graphics.FromImage(Img)
g.DrawString("Test", New Font("Arial", 15, FontStyle.Bold), _
New SolidBrush(Color.Red), 25, 35)
Img.Save("C:\MyStamp.jpg", System.Drawing.Imaging.ImageFormat.Jpeg)

End Function











Jialiang Ge said:
Hello Mark,

As Cor suggested, we can
1. Create a Bitmap object
'Create Bitmap object of specific width and height
Dim Img As New Bitmap(intWidth, intHeight)

2. Create the Graphics object using the Bitmap object
'Obtain Graphics object to perform graphics opration
Dim g As Graphics = Graphics.FromImage(Img)

3. Use the DrawString() method of the Graphics class to draw the figures
in
the badge
'Use drawString method of the graphics object to write text on target
bitmap
g.DrawString("Test", New Font("Arial", 15, FontStyle.Bold), _
New SolidBrush(Color.Red), 25, 35)

4. Save the image to a temporary directory:
'Save this bitmap using its save method as .Tiff,.jpg or any other image
ImgStamp.Save(YourPath &
"\MyStamp.jpg",System.Drawing.Imaging.ImageFormat.Jpg))

After then, display the image in your page.

Regards,
Jialiang Ge ([email protected], remove 'online.')
Microsoft Online Community Support

=================================================
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you.
Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

This posting is provided "AS IS" with no warranties, and confers no
rights.
=================================================
 
Hmm. I don't know where I can see where was it closed before save:

Shared Function fDisplayBadge(ByVal strDot As String, ByVal strGrade As
String) As Object

Dim Img As New Bitmap(100, 100)
Dim g As Graphics = Graphics.FromImage(Img)
g.DrawString("Test", New Font("Arial", 15, FontStyle.Bold), _
New SolidBrush(Color.Red), 25, 35)
Img.Save("C:\MyStamp.jpg", System.Drawing.Imaging.ImageFormat.Jpeg)

End Function






Jialiang Ge said:
It is because the source stream was closed before we save it.
You may have a look at this KB article
http://support.microsoft.com/kb/814675/en-us
or this thread that I once handled:
http://www.microsoft.com/communitie...884-86b1-fc3ec838cba4&lang=en&cr=us&sloc=&p=1

Regards,
Jialiang Ge ([email protected], remove 'online.')
Microsoft Online Community Support

=================================================
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

This posting is provided "AS IS" with no warranties, and confers no
rights.
=================================================


Mark B said:
An error message shows when I try and execute that code: "A generic error
occurred in GDI+. "

Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Runtime.InteropServices.ExternalException: A
generic error occurred in GDI+.

Source Error:

Line 73: <td rowspan="2">g
Line 74:
Line 75: <% =SharedFunctions.fDisplayBadge("28K", "B+")
Line 76:
Line 77:

Source File: C:\Users\Mark\Documents\Visual Studio
2008\WebSites\LocalWeb\pages\verify\group\default.aspx Line: 75

Stack Trace:

[ExternalException (0x80004005): A generic error occurred in GDI+.]
System.Drawing.Image.Save(String filename, ImageCodecInfo encoder,
EncoderParameters encoderParams) +397778
System.Drawing.Image.Save(String filename, ImageFormat format) +69
SharedFunctions.fDisplayBadge(String strDot, String strGrade) +178
ASP.pages_verify_group_default_aspx.__Render__control1(HtmlTextWriter
__w, Control parameterContainer) in C:\Users\Mark\Documents\Visual Studio
2008\WebSites\LocalWeb\pages\verify\group\default.aspx:75
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer,
ICollection children) +98
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +20
System.Web.UI.Page.Render(HtmlTextWriter writer) +26
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer,
ControlAdapter adapter) +25
System.Web.UI.Control.RenderControl(HtmlTextWriter writer,
ControlAdapter adapter) +121
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +22
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
+2558

--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.1433;
ASP.NET Version:2.0.50727.1433


The code I used was:

<% =SharedFunctions.fDisplayBadge("28K", "B+") %>

in an aspx page and:

Shared Function fDisplayBadge(ByVal strDot As String, ByVal strGrade As
String) As Object

Dim Img As New Bitmap(100, 100)
Dim g As Graphics = Graphics.FromImage(Img)
g.DrawString("Test", New Font("Arial", 15, FontStyle.Bold), _
New SolidBrush(Color.Red), 25, 35)
Img.Save("C:\MyStamp.jpg",
System.Drawing.Imaging.ImageFormat.Jpeg)

End Function











Jialiang Ge said:
Hello Mark,

As Cor suggested, we can
1. Create a Bitmap object
'Create Bitmap object of specific width and height
Dim Img As New Bitmap(intWidth, intHeight)

2. Create the Graphics object using the Bitmap object
'Obtain Graphics object to perform graphics opration
Dim g As Graphics = Graphics.FromImage(Img)

3. Use the DrawString() method of the Graphics class to draw the figures
in
the badge
'Use drawString method of the graphics object to write text on target
bitmap
g.DrawString("Test", New Font("Arial", 15, FontStyle.Bold), _
New SolidBrush(Color.Red), 25, 35)

4. Save the image to a temporary directory:
'Save this bitmap using its save method as .Tiff,.jpg or any other image
ImgStamp.Save(YourPath &
"\MyStamp.jpg",System.Drawing.Imaging.ImageFormat.Jpg))

After then, display the image in your page.

Regards,
Jialiang Ge ([email protected], remove 'online.')
Microsoft Online Community Support

=================================================
Delighting our customers is our #1 priority. We welcome your comments
and
suggestions about how we can improve the support we provide to you.
Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

This posting is provided "AS IS" with no warranties, and confers no
rights.
=================================================
 
Never mind it must have been a file permissions issue:
C:\Users\Mark\Documents\Visual Studio 2008\MyStamp.jpg rather than
'C:\MyStamp.jpg' worked.

What if I want the text to overlay an existing graphic object (e.g. badge
template jpeg)?


Mark B said:
Hmm. I don't know where I can see where was it closed before save:

Shared Function fDisplayBadge(ByVal strDot As String, ByVal strGrade As
String) As Object

Dim Img As New Bitmap(100, 100)
Dim g As Graphics = Graphics.FromImage(Img)
g.DrawString("Test", New Font("Arial", 15, FontStyle.Bold), _
New SolidBrush(Color.Red), 25, 35)
Img.Save("C:\MyStamp.jpg",
System.Drawing.Imaging.ImageFormat.Jpeg)

End Function






Jialiang Ge said:
It is because the source stream was closed before we save it.
You may have a look at this KB article
http://support.microsoft.com/kb/814675/en-us
or this thread that I once handled:
http://www.microsoft.com/communitie...884-86b1-fc3ec838cba4&lang=en&cr=us&sloc=&p=1

Regards,
Jialiang Ge ([email protected], remove 'online.')
Microsoft Online Community Support

=================================================
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you.
Please feel free to let my manager know what you think of the level of
service provided. You can send feedback directly to my manager at:
(e-mail address removed).

This posting is provided "AS IS" with no warranties, and confers no
rights.
=================================================


Mark B said:
An error message shows when I try and execute that code: "A generic
error occurred in GDI+. "

Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Runtime.InteropServices.ExternalException: A
generic error occurred in GDI+.

Source Error:

Line 73: <td rowspan="2">g
Line 74:
Line 75: <% =SharedFunctions.fDisplayBadge("28K", "B+")
Line 76:
Line 77:

Source File: C:\Users\Mark\Documents\Visual Studio
2008\WebSites\LocalWeb\pages\verify\group\default.aspx Line: 75

Stack Trace:

[ExternalException (0x80004005): A generic error occurred in GDI+.]
System.Drawing.Image.Save(String filename, ImageCodecInfo encoder,
EncoderParameters encoderParams) +397778
System.Drawing.Image.Save(String filename, ImageFormat format) +69
SharedFunctions.fDisplayBadge(String strDot, String strGrade) +178
ASP.pages_verify_group_default_aspx.__Render__control1(HtmlTextWriter
__w, Control parameterContainer) in C:\Users\Mark\Documents\Visual
Studio 2008\WebSites\LocalWeb\pages\verify\group\default.aspx:75
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer,
ICollection children) +98
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +20
System.Web.UI.Page.Render(HtmlTextWriter writer) +26
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer,
ControlAdapter adapter) +25
System.Web.UI.Control.RenderControl(HtmlTextWriter writer,
ControlAdapter adapter) +121
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +22
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
+2558

--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.1433;
ASP.NET Version:2.0.50727.1433


The code I used was:

<% =SharedFunctions.fDisplayBadge("28K", "B+") %>

in an aspx page and:

Shared Function fDisplayBadge(ByVal strDot As String, ByVal strGrade As
String) As Object

Dim Img As New Bitmap(100, 100)
Dim g As Graphics = Graphics.FromImage(Img)
g.DrawString("Test", New Font("Arial", 15, FontStyle.Bold), _
New SolidBrush(Color.Red), 25, 35)
Img.Save("C:\MyStamp.jpg",
System.Drawing.Imaging.ImageFormat.Jpeg)

End Function











Hello Mark,

As Cor suggested, we can
1. Create a Bitmap object
'Create Bitmap object of specific width and height
Dim Img As New Bitmap(intWidth, intHeight)

2. Create the Graphics object using the Bitmap object
'Obtain Graphics object to perform graphics opration
Dim g As Graphics = Graphics.FromImage(Img)

3. Use the DrawString() method of the Graphics class to draw the
figures in
the badge
'Use drawString method of the graphics object to write text on target
bitmap
g.DrawString("Test", New Font("Arial", 15, FontStyle.Bold), _
New SolidBrush(Color.Red), 25, 35)

4. Save the image to a temporary directory:
'Save this bitmap using its save method as .Tiff,.jpg or any other
image
ImgStamp.Save(YourPath &
"\MyStamp.jpg",System.Drawing.Imaging.ImageFormat.Jpg))

After then, display the image in your page.

Regards,
Jialiang Ge ([email protected], remove 'online.')
Microsoft Online Community Support

=================================================
Delighting our customers is our #1 priority. We welcome your comments
and
suggestions about how we can improve the support we provide to you.
Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

This posting is provided "AS IS" with no warranties, and confers no
rights.
=================================================
 
Mark said:
I want the performance badge to include the two figures inside it.

I want the whole badge to be clickable so I am guessing the results of
the functions can't be text else the cursor will appear when people
click on the badge.

My thought then is that the badge needs to be constructed programmically
at run-time to incorporate those figures as pictures, or better still as
part of the overall graphic.

Why make it so very complicated? A browser is capable of displaying text
on top of an image, and also capable of showing a pointer cursor instead
of a text cursor.

Example:

<a href="detailspage.html" target="_blank"
style="display:block;width:50px;height:50px;background:url(badge.gif);text-align:center;line-height:25px;cursor:pointer;">A+<br/>$87K</a>
 
If they click on the text, will it re-direct to a URL like it would if they
clicked on the image?
 
Mark said:
If they click on the text, will it re-direct to a URL like it would if
they clicked on the image?

In my example there is no separate image element and separate text
elements. The link contains the text and has a background image. There
is no difference if you click on the part of the link where there is
text or the part where there is just the background image.
 
That all works OK now.

Now what about if I want to allow other webmasters to have our dynamic
salesperson performance badges on their websites?

I could pass them the salesperson ID number but what else would I need to
have them include in their HTML? I want them to be able to 'click-to-verify'
to be taken to the salesperson's details page.






Jialiang Ge said:
It is because the source stream was closed before we save it.
You may have a look at this KB article
http://support.microsoft.com/kb/814675/en-us
or this thread that I once handled:
http://www.microsoft.com/communitie...884-86b1-fc3ec838cba4&lang=en&cr=us&sloc=&p=1

Regards,
Jialiang Ge ([email protected], remove 'online.')
Microsoft Online Community Support

=================================================
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

This posting is provided "AS IS" with no warranties, and confers no
rights.
=================================================


Mark B said:
An error message shows when I try and execute that code: "A generic error
occurred in GDI+. "

Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Runtime.InteropServices.ExternalException: A
generic error occurred in GDI+.

Source Error:

Line 73: <td rowspan="2">g
Line 74:
Line 75: <% =SharedFunctions.fDisplayBadge("28K", "B+")
Line 76:
Line 77:

Source File: C:\Users\Mark\Documents\Visual Studio
2008\WebSites\LocalWeb\pages\verify\group\default.aspx Line: 75

Stack Trace:

[ExternalException (0x80004005): A generic error occurred in GDI+.]
System.Drawing.Image.Save(String filename, ImageCodecInfo encoder,
EncoderParameters encoderParams) +397778
System.Drawing.Image.Save(String filename, ImageFormat format) +69
SharedFunctions.fDisplayBadge(String strDot, String strGrade) +178
ASP.pages_verify_group_default_aspx.__Render__control1(HtmlTextWriter
__w, Control parameterContainer) in C:\Users\Mark\Documents\Visual Studio
2008\WebSites\LocalWeb\pages\verify\group\default.aspx:75
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer,
ICollection children) +98
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +20
System.Web.UI.Page.Render(HtmlTextWriter writer) +26
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer,
ControlAdapter adapter) +25
System.Web.UI.Control.RenderControl(HtmlTextWriter writer,
ControlAdapter adapter) +121
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +22
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
+2558

--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.1433;
ASP.NET Version:2.0.50727.1433


The code I used was:

<% =SharedFunctions.fDisplayBadge("28K", "B+") %>

in an aspx page and:

Shared Function fDisplayBadge(ByVal strDot As String, ByVal strGrade As
String) As Object

Dim Img As New Bitmap(100, 100)
Dim g As Graphics = Graphics.FromImage(Img)
g.DrawString("Test", New Font("Arial", 15, FontStyle.Bold), _
New SolidBrush(Color.Red), 25, 35)
Img.Save("C:\MyStamp.jpg",
System.Drawing.Imaging.ImageFormat.Jpeg)

End Function











Jialiang Ge said:
Hello Mark,

As Cor suggested, we can
1. Create a Bitmap object
'Create Bitmap object of specific width and height
Dim Img As New Bitmap(intWidth, intHeight)

2. Create the Graphics object using the Bitmap object
'Obtain Graphics object to perform graphics opration
Dim g As Graphics = Graphics.FromImage(Img)

3. Use the DrawString() method of the Graphics class to draw the figures
in
the badge
'Use drawString method of the graphics object to write text on target
bitmap
g.DrawString("Test", New Font("Arial", 15, FontStyle.Bold), _
New SolidBrush(Color.Red), 25, 35)

4. Save the image to a temporary directory:
'Save this bitmap using its save method as .Tiff,.jpg or any other image
ImgStamp.Save(YourPath &
"\MyStamp.jpg",System.Drawing.Imaging.ImageFormat.Jpg))

After then, display the image in your page.

Regards,
Jialiang Ge ([email protected], remove 'online.')
Microsoft Online Community Support

=================================================
Delighting our customers is our #1 priority. We welcome your comments
and
suggestions about how we can improve the support we provide to you.
Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

This posting is provided "AS IS" with no warranties, and confers no
rights.
=================================================
 
Back
Top