Csharp .Net image processing error
-
Hi I wrote the code for adding image as well as saving the image but whenever I add photos and save them the original size of the photos gets reduced.It takes size of 80,80 I commented the line but still the size of the photos is 80,80 Can somebody pls help......
//to add photos private void btnAddPhotos_Click(object sender, EventArgs e) { openFileDialog.Filter = "Image Files(*.BMP;*.JPG;*.GIF)|*.BMP;*.JPG;*.GIF|All files (*.*)|*.*"; openFileDialog.Multiselect = true; if (openFileDialog.ShowDialog() == DialogResult.OK) { listView1.View = View.LargeIcon; //imageList.ImageSize = new Size(80, 80); for (int c = 0; c < openFileDialog.FileNames.Length; c++) { Image i = Image.FromFile(openFileDialog.FileNames[c].ToString()); Image img = i.GetThumbnailImage(256, 256, null, new IntPtr()); imageList.Images.Add(img); } listView1.LargeImageList = imageList; int cntl = listView1.Items.Count; if (cntl == 1) { ListViewItem lstItem = new ListViewItem(); lstItem.ImageIndex = 1; listView1.Items.Add(lstItem); } else { for (int j = cntl; j < imageList.Images.Count; j++) { ListViewItem lstItem = new ListViewItem(); lstItem.ImageIndex = j; listView1.Items.Add(lstItem); } } } else { return; } } //to save photos private void btnSavePhotos_Click(object sender, EventArgs e) { clsImageSettings saveFileDia = new clsImageSettings(); clsImageSettings objSaveImage = new clsImageSettings(); FolderBrowserDialog objFolderDai = new FolderBrowserDialog(); string imgPath = ""; if (listView1.Items.Count > 0) { if (objFolderDai.ShowDialog() == DialogResult.OK) { imgPath = objFolderDai.SelectedPath; for (int i = 0; i < openFileDialog.SafeFileNames.Length; i++) { string imgFilePath = openFileDialo
-
Hi I wrote the code for adding image as well as saving the image but whenever I add photos and save them the original size of the photos gets reduced.It takes size of 80,80 I commented the line but still the size of the photos is 80,80 Can somebody pls help......
//to add photos private void btnAddPhotos_Click(object sender, EventArgs e) { openFileDialog.Filter = "Image Files(*.BMP;*.JPG;*.GIF)|*.BMP;*.JPG;*.GIF|All files (*.*)|*.*"; openFileDialog.Multiselect = true; if (openFileDialog.ShowDialog() == DialogResult.OK) { listView1.View = View.LargeIcon; //imageList.ImageSize = new Size(80, 80); for (int c = 0; c < openFileDialog.FileNames.Length; c++) { Image i = Image.FromFile(openFileDialog.FileNames[c].ToString()); Image img = i.GetThumbnailImage(256, 256, null, new IntPtr()); imageList.Images.Add(img); } listView1.LargeImageList = imageList; int cntl = listView1.Items.Count; if (cntl == 1) { ListViewItem lstItem = new ListViewItem(); lstItem.ImageIndex = 1; listView1.Items.Add(lstItem); } else { for (int j = cntl; j < imageList.Images.Count; j++) { ListViewItem lstItem = new ListViewItem(); lstItem.ImageIndex = j; listView1.Items.Add(lstItem); } } } else { return; } } //to save photos private void btnSavePhotos_Click(object sender, EventArgs e) { clsImageSettings saveFileDia = new clsImageSettings(); clsImageSettings objSaveImage = new clsImageSettings(); FolderBrowserDialog objFolderDai = new FolderBrowserDialog(); string imgPath = ""; if (listView1.Items.Count > 0) { if (objFolderDai.ShowDialog() == DialogResult.OK) { imgPath = objFolderDai.SelectedPath; for (int i = 0; i < openFileDialog.SafeFileNames.Length; i++) { string imgFilePath = openFileDialo
Rule one: If you are going to post code fragments - especially long code fragments - use the "code block" widget (or <pre> </pre> tags) to preserve the formatting, not the "inline code" widget (or <code> </code> tags). Rule two: From a quick scan (which is all I'll do with unformatted stuff), it is a good idea when reading in an image file to keep both the image, and the thumbnail - not keep the thumbnail and throw away the image... Would it surprise you to know that a thumbnail is 80 x 80? Suggest anything about you problem?
You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace C/C++ (I dont see a huge difference between them, and the 'benefits' of C++ are questionable, who needs inheritance when you have copy and paste) - fat_boy
-
Rule one: If you are going to post code fragments - especially long code fragments - use the "code block" widget (or <pre> </pre> tags) to preserve the formatting, not the "inline code" widget (or <code> </code> tags). Rule two: From a quick scan (which is all I'll do with unformatted stuff), it is a good idea when reading in an image file to keep both the image, and the thumbnail - not keep the thumbnail and throw away the image... Would it surprise you to know that a thumbnail is 80 x 80? Suggest anything about you problem?
You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace C/C++ (I dont see a huge difference between them, and the 'benefits' of C++ are questionable, who needs inheritance when you have copy and paste) - fat_boy
I want the images to be in original size as they were before i dont want them to get small can u suggest something
-
I want the images to be in original size as they were before i dont want them to get small can u suggest something
When you save, perhaps saving the thumbnail image is not the best way to get a full size picture?
You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace C/C++ (I dont see a huge difference between them, and the 'benefits' of C++ are questionable, who needs inheritance when you have copy and paste) - fat_boy
-
When you save, perhaps saving the thumbnail image is not the best way to get a full size picture?
You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace C/C++ (I dont see a huge difference between them, and the 'benefits' of C++ are questionable, who needs inheritance when you have copy and paste) - fat_boy
This can not possibly be a "good answer", as all you do is reply with yet another question... how about providing a real suggestion? :laugh:
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
Prolific encyclopedia fixture proof-reader browser patron addict?
We all depend on the beast below.
-
This can not possibly be a "good answer", as all you do is reply with yet another question... how about providing a real suggestion? :laugh:
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
Prolific encyclopedia fixture proof-reader browser patron addict?
We all depend on the beast below.
Keep 'em guessing, that what I say! :laugh:
You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace C/C++ (I dont see a huge difference between them, and the 'benefits' of C++ are questionable, who needs inheritance when you have copy and paste) - fat_boy