Home
Explore
Tags
Contribute
Home
»
VB.NET
»
GDI+ IN VB.NET
Drawing GDI+ Images on the Web in VB.NET
Posted in
VB.NET
|
GDI+ IN VB.NET
on
November 05, 2019
Tags:
drawing image
,
VB.NET
,
GDI+
,
WEB
In this article you will learn how to Draw Images on the Web in GDI+.
2960
The process of drawing images on the Web is slightly different from that of drawing images on Windows Forms. In Windows Forms we create a Bitmap object and call the Graphics.DrawImage method. Drawing on the Web requires a Graphics object. The Bitmap.Save method takes care of the rest, as discussed earlier.
To test this, let's create a Web application using Visual Studio .NET and add the code given in Listing 12.5 on the page-load event. This code views an image on the browser. First we create a Bitmap object from an image, then we create a Graphic object from the image, and then we call the Save method of Bitmap.
LISTING 12.5: Drawing images on the Web
'Create a Bitmap object from a file
Dim curBitmap As New Bitmap("d;\white_salvia.jpg")
'Create a Graphics object from Bitmap
Dim g As Graphics = Graphics.FromImage(curBitmap)
'Send output to the browser
curBitmap.Save(Me.REsponse.OutputStream, ImageFormat.Jpeg)
'Dispose of object
g.Dispose()
Notice that we didn't even need to call the DrawImage method. Figure 12.11 shows the output from Listing 12.5.
Setting Image Quality
The SmoothingMode and TextRenderingHint properties of the Graphics object can be used to set the quality of images and text, respectively. GDI+ cannot draw text directly into a Web application. Like lines, curves, and other graphics shapes, text must also be rendered as an image for display in the browser. All graphics lines, curves, shapes, text and images are first converted to an image and directed to a browser, so only the SmoothingMode property will be applicable. SmoothingMode has five members: AntiAlias, Default, HighQuality, HighSpeed, and None. The following code snippet sets the smoothing mode of the Graphics object:
'Set modes
g.SmoothingMode = SmoothingMode.AntiAlias
FIGURE 12.11: Drawing an image
Conclusion
Hope this article would have helped you in understanding Drawing Images on the Web in GDI+ . See my other articles on the website on GDI+.
Related Articles
Image Animation in VB.NET using GDI+
Select Method carefully in GDI+ using VB.NET
Saving Images & Image Format Properties in GDI+ using VB.NET
Create ASP .NET Web Application in GDI+ using VB.NET
Drawing Simple Graphics in VB.NET
WPF Column Chart in VB.NET
Web Services and ASP.NET in VB.NET
Adding GDI+ Web Controls to a Web Form in VB.NET
Create and Save Bitmap Image in VB.NET?
WPF Grid Using VB.NET
Categories
ACTIVE DIRECTOTRY IN VB.NET
ALGORITHMS AND VB.NET
ARRAY IN VB.NET
ASP.NET AJAX IN VB.NET
ASP.NET USING VB.NET
ASSEMBLIES IN VB.NET
COM INTEROP IN VB.NET
CRYPTOGRAPHY IN VB.NET
CRYSTAL REPORTS IN VB.NET
DATABASE & DBA
DEPLOYMENT IN VB.NET
DESIGN & ARCHITECTURE
DIRECTX WITH VB.NET
ENTERPRISE DEVELOPMENT
FILE IN VB.NET
GAMES IN VB.NET
GDI+ IN VB.NET
GENERAL
LINQ WITH VB.NET
MOBILE DEV IN VB.NET
MULTITHREADING IN VB.NET
NETWORKIN WITH VB.NET
OFFICE AND VB.NET
PRINTING IN VB.NET
REMOTING IN VB.NET
REPORTS IN VB.NET
SECURITY IN VB.NET
SILVERLIGHT USING VB.NET
Speech in VB.NET
STRING IN VB.NET
TABLET PC
VB.NET ADO.NET
VB.NET ARTICLE
VB.NET EXCEPTION HANDLING
VB.NET FAQ
VB.NET HOW DO I
VB.NET LANGUAGE
VB.NET TUTORIALS
VB.NET WINDOWS SERVICES
VBA
VISUAL BASIC 10
VISUAL BASIC LANGUAGE
WCF WITH VB.NET
WEB CONTROL IN VB.NET
WEB DEV IN VB.NET
WEB FORM WITH VB.NET
WEB SERVICES IN VB.NET
WINDOWS CONTROLS
WINDOWS FORMS IN VB.NET
WORKFLOW IN VB.NET
WPF IN VB.NET
XAML IN VB.NET
XML IN VB.NET
More Articles
Stroke Caps in GDI+ using VB.NET
Basic GDI+ Objects in VB.NET
Transformation in GDI+ in VB.NET
Drawing Images in GDI+ in VB.NET
Working with GDI+ Fonts in VB.NET
GDI+ Pie Chart in VB.NET
Using GDI+ Graphics Paths in VB.NET
Drawing Lines in GDI+ using VB.NET
Printing Text in GDI+ using VB.NET
Designing GUI Applications in GDI+ using VB.NET
Printer Settings in GDI+ and VB.NET
No GDI Calls between GetHdc and ReleaseHdc in VB.NET
GDI Managed Environment in VB.NET
Use GDI+ System Brushes and Pens in VB.NET
Select Method carefully in GDI+ using VB.NET
Use Graphics Paths in GDI+ using VB.NET
SetStyle Method in GDI+ using VB.NET
Overriding the GDI+ OnPaint Method in VB.NET
GDI+ Double Buffering and Flicker-Free Drawing in VB.NET
GDi+ Scope and Type of Variable and Performance in VB.NET
Add GDI+ Paint Event Handler and Controls in VB.NET
Understanding the GDI+ Paint Event in VB.NET
Create ASP .NET Web Application in GDI+ using VB.NET
Working with Text and Strings in VB.NET
GDI+ Transforming Text in VB.NET
GDI+ LinearGradientBrush and PathGradientBrush in VB.NET
Drawing GDI+ Images on the Web in VB.NET
Drawing Simple Graphics in VB.NET
Graphics Web Application in GDI+ usnig VB.NET
Adding GDI+ Web Controls to a Web Form in VB.NET
Customizing Page Settings in GDI+ using VB.NET
DetailsCustom Controlling and Print Controller in VB.NET
Drawing Graphics Shapes in VB.NET
The DocumentName Property and Marginal Printing in VB.NET
Draw 2D graphics line,tringle,ellipse,polygon in VB.NET
Print Dialogs in GDI+ using VB.NET
Printing Graphics in GDI+ using VB.NET
Printing Text in GDI+ using VB.NET
A GDI+ Printer Settings Example in VB.NET
GDI+ Pinting Application in VB.NET
Printer Settings in GDI+ using VB.NET
GDI+ PaperSize Class in VB.NET
Printing in GDI+ using VB.NET
GDI+ Text Transformation in VB.NET
Color Transformation and the Color Matrix in VB.NET
Image Transformation in GDI+ using VB.NET
GDI+ Scaling, Shearing and Rotating Colors in VB.NET
GDI+ Miscellaneous Advanced 2D Topics in VB.NET
Mixed Blending in GDI+ using VB.Net
Compositing Mode and Blending in VB.NET
© 2020 DotNetHeaven. All rights reserved.
TERMS & CONDITIONS
|
CONTACT US
|
REPORT ABUSE