Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Csharp .Net image processing error

Csharp .Net image processing error

Scheduled Pinned Locked Moved C#
csharphelpc++
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    djsproject
    wrote on last edited by
    #1

    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

    OriginalGriffO 1 Reply Last reply
    0
    • D djsproject

      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

      OriginalGriffO Offline
      OriginalGriffO Offline
      OriginalGriff
      wrote on last edited by
      #2

      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 have no idea what I did, but I'm taking full credit for it." - ThisOldTony
      "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

      D 1 Reply Last reply
      0
      • OriginalGriffO OriginalGriff

        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

        D Offline
        D Offline
        djsproject
        wrote on last edited by
        #3

        I want the images to be in original size as they were before i dont want them to get small can u suggest something

        OriginalGriffO 1 Reply Last reply
        0
        • D djsproject

          I want the images to be in original size as they were before i dont want them to get small can u suggest something

          OriginalGriffO Offline
          OriginalGriffO Offline
          OriginalGriff
          wrote on last edited by
          #4

          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

          "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
          "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

          L 1 Reply Last reply
          0
          • OriginalGriffO OriginalGriff

            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

            L Offline
            L Offline
            Luc Pattyn
            wrote on last edited by
            #5

            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.


            OriginalGriffO 1 Reply Last reply
            0
            • L Luc Pattyn

              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.


              OriginalGriffO Offline
              OriginalGriffO Offline
              OriginalGriff
              wrote on last edited by
              #6

              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

              "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
              "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups