Storing image in db
I want to store the image in the database,when it is display i want to decrease the size of it ! is that possiblity doing like that?otherwise how i decrease the image size?
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Mahesh ChandRank #1 · 393.3K reputationPosted Mar 9, 2011, 4:47 AM EST
You can decrease the size of any image by using CreateThumbnail method of Image and specify a size. IF you want to keep the original file and just want to display in a different size, you can also use its Height and Width properties.
Cheers!
Jaganathan BantheswaranRank #170 · 14.1K reputationPosted Mar 9, 2011, 5:01 AM EST
Try like this.
FileStream FS1 = new FileStream("image.jpg", FileMode.Create); foreach (DataRow dataRow in dataTable.Rows) { if (dataRow[0].ToString() == comboBox1.SelectedItem.ToString()) { byte[] blob = (byte[])dataRow[1]; FS1.Write(blob, 0, blob.Length); FS1.Close(); FS1 = null; pictureBox2.Image = Image.FromFile("image.jpg"); pictureBox2.SizeMode = PictureBoxSizeMode.StretchImage; pictureBox2.Refresh(); } } Just have a look at; Nice article here on c sharpcornerSuthish NairRank #92 · 22.8K reputationPosted Mar 10, 2011, 9:11 AM EST