Atlanta Custom Software Development 

 
   Search        Code/Page
 

User Login
Email

Password

 

Forgot the Password?
Services
» Web Development
» Maintenance
» Data Integration/BI
» Information Management
Programming
  Database
Automation
OS/Networking
Graphics
Links
Tools
» Regular Expr Tester
» Free Tools

ShowImage - Output an image as a binary stream to the Response object

Total Hit ( 1509)

Rate this article:     Poor     Excellent 

 Submit Your Question/Comment about this article

Rating


 


Click here to copy the following block
' Output an image as a binary stream to the Response object
Sub ShowImage(ByVal bmp As Bitmap)
  ' Clear current content and set returned content type
  HttpContext.Current.Response.Clear()
  HttpContext.Current.Response.ContentType = "image/jpeg"
  ' Save to the Response.OutputStream object
  bmp.Save(HttpContext.Current.Response.OutputStream, _
    Imaging.ImageFormat.Jpeg)

  bmp.Dispose()
  HttpContext.Current.Response.End()
End Sub


' Example:

Private Sub Page_Load(ByVal sender As System.Object, _
  ByVal e As System.EventArgs) Handles MyBase.Load
  ' Create a bitmap with given width, height, and color depth.
  Dim bmp As New Bitmap(400, 200, _
    Drawing.Imaging.PixelFormat.Format16bppRgb565)
  ' Get the underlying Graphics object.
  Dim gr As Graphics = Graphics.FromImage(bmp)
  ' Clear its background.
  gr.Clear(Color.Red)

  ' create a font
  Dim fnt As New Font("Arial", 16, FontStyle.Regular, GraphicsUnit.Point)

  Dim angle As Single
  For angle = 0 To 360 Step 30
    ' Reset coordinate transforms.
    gr.ResetTransform()
    ' Translate and rotate the coordinate system.
    gr.TranslateTransform(200, 100)
    gr.RotateTransform(angle)
    ' Draw the (rotated) string.
    gr.DrawString("  hello", fnt, Brushes.Yellow, 0, 0)
  Next
  ' Release resources.
  fnt.Dispose()
  gr.Dispose()

  ShowImage(bmp)
End Sub


Submitted By : Nayan Patel  (Member Since : 5/26/2004 12:23:06 PM)

Job Description : He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting.
View all (893) submissions by this author  (Birth Date : 7/14/1981 )


Home   |  Comment   |  Contact Us   |  Privacy Policy   |  Terms & Conditions   |  BlogsZappySys

© 2008 BinaryWorld LLC. All rights reserved.