C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Code Snippets » Images »

Convert An Image to Thumbnail In VB .Net


Posted Date: 13 Jun 2009    Resource Type: Code Snippets    Category: Images
Author: kingfisherMember Level: Gold    
Rating: 1 out of 5Points: 7



Hi All,

Here i feel to share a simple VB. Net code, which help to convert the selected image from a location into a thumbnail and display it into a PictureBox Control.


Imports System.IO

Dim Data() As Byte
Dim OFile As New System.Windows.Forms.OpenFileDialog

OFile.Filter = "All Files (*.*)|*.*| (*.JPEG)|*.jpg|(*.BMP)|*.bmp|(*.GIF)|*.gif"
OFile.ShowDialog()
If OFile.FileNames.Length > 0 Then
txtimgpath.Text = OFile.FileName

Dim fs As New FileStream(Trim(txtimgpath.Text), FileMode.Open)
Data = New [Byte](fs.Length) {}
fs.Read(Data, 0, fs.Length)

Dim memorybits As New MemoryStream(Data)
Dim img As System.Drawing.Image
img = System.Drawing.Image.FromStream(memorybits)
Dim inp As New IntPtr
Dim thumb As System.Drawing.Image
thumb = img.GetThumbnailImage(150, 110, Nothing, inp)

PictureBox1.Image = thumb
end if



Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
Display Thumbnail  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Save image into Database and folder in C#
Previous Resource: Resize an image's dimensions and Save it as a file in different extension
Return to Discussion Resource Index
Post New Resource
Category: Images


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use