.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Home >> Forum >> C# >> Post New QuestionBookmark and Share Subscribe to Forum

How to make thumbnail of one image in C# + windows aplication.....

Posted By: susant     Posted Date: January 09, 2009    Points:2   Category :C#
Hi all

How to create a thumbnail of one image, and show it on Picture box, stored in database and retrive from databse....

Note: I am using C# + Windows Application....

some code here for show and save in databse

To show image and show in PictureBox
public void show_image()
OpenFileDialog OF = new OpenFileDialog();
OF.Filter = "All Pictures|*.bmp;*.gif;*.jpg|Bitmaps|*.bmp|GIFs|*.gif|JPEGs|*.jpg";
if (OF.ShowDialog() == DialogResult.OK)

string imagename = OF.FileName;
Bitmap newimg = new Bitmap(imagename);

pictureBox1.Image = (Image)newimg;
textBox1.Text = OF.FileName.Substring(OF.FileName.LastIndexOf("\\") + 1);

Method for save in databse

public void image_save()
if (pictureBox1.Image!=null)
OpenFileDialog OF = new OpenFileDialog();

//string imagename = OF.FileName.Substring(OF.FileName.LastIndexOf("\\") + 1);
string imagename = textBox1.Text.Substring(textBox1.Text.LastIndexOf("\\") + 1);
MemoryStream ms = new MemoryStream();
pictureBox1.Image.Save(ms, pictureBox1.Image.RawFormat);
byte[] arrimg = ms.GetBuffer();

string str = "insert into mstImg(ImgName,Img) values('" + imagename + "','" + arrimg + "')";
MessageBox.Show("Image Saved...!!");
MessageBox.Show("No Image To Saved...!!");


1: Retrive Image from datbase
2: create Thumbnial of Image and save that thumbnail image in databse...
3: How to show image in Picture Box while retriving from databse..


Author: Praveen             
Posted Date: January 11, 2009     Points: 5   

you can refer this code to create thumbnail image this example in asp.net but you can use the function in windows application.


Author: longwest             
Posted Date: March 26, 2015     Points: 20   

Here's the answer I found on stackoverflow:

Best regards.

Post Reply

You must Sign In To post reply
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend