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. .NET (Core and Framework)
  4. changing image resolution in C#.NET

changing image resolution in C#.NET

Scheduled Pinned Locked Moved .NET (Core and Framework)
csharpgraphicshelpquestion
4 Posts 2 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.
  • S Offline
    S Offline
    sarabjs
    wrote on last edited by
    #1

    I wish to convert a 96dpi image to a 300dpi image in .NET... Here's the code I currently use: // iMage is the original 96dpi image int iNht=(iMage.Height*300)/96; int iNwd=(iMage.Width*300)/96; Bitmap bMap=new Bitmap(iMage,iNwd,iNht); bMap.SetResolution(300,300); iMage=bMap; The code works fine, but there's one problem - the 300dpi image is of poor quality (appears kinda faded)... Time is of concern, so I'm avoiding needing to write my own resize method... But the poorer quality is also not acceptable!! :( Any ideas?? Thanks!!

    G 1 Reply Last reply
    0
    • S sarabjs

      I wish to convert a 96dpi image to a 300dpi image in .NET... Here's the code I currently use: // iMage is the original 96dpi image int iNht=(iMage.Height*300)/96; int iNwd=(iMage.Width*300)/96; Bitmap bMap=new Bitmap(iMage,iNwd,iNht); bMap.SetResolution(300,300); iMage=bMap; The code works fine, but there's one problem - the 300dpi image is of poor quality (appears kinda faded)... Time is of concern, so I'm avoiding needing to write my own resize method... But the poorer quality is also not acceptable!! :( Any ideas?? Thanks!!

      G Offline
      G Offline
      Guffa
      wrote on last edited by
      #2

      You are not only changing the resolution, you are also resizing it. As you enlarge it to more than three times the original size, of course the image quality will be bad. Even if the image is larger, there still isn't any more detail information than in the original image. If the image looks faded and not pixly, the resize is most likely using the bicubic method. It's the best you can do with conventional methods. If you wan't a better resizing method you might look up something called Genuine Fractals. --- b { font-weight: normal; }

      S 2 Replies Last reply
      0
      • G Guffa

        You are not only changing the resolution, you are also resizing it. As you enlarge it to more than three times the original size, of course the image quality will be bad. Even if the image is larger, there still isn't any more detail information than in the original image. If the image looks faded and not pixly, the resize is most likely using the bicubic method. It's the best you can do with conventional methods. If you wan't a better resizing method you might look up something called Genuine Fractals. --- b { font-weight: normal; }

        S Offline
        S Offline
        sarabjs
        wrote on last edited by
        #3

        That was helpful... Thanks Guffa!

        1 Reply Last reply
        0
        • G Guffa

          You are not only changing the resolution, you are also resizing it. As you enlarge it to more than three times the original size, of course the image quality will be bad. Even if the image is larger, there still isn't any more detail information than in the original image. If the image looks faded and not pixly, the resize is most likely using the bicubic method. It's the best you can do with conventional methods. If you wan't a better resizing method you might look up something called Genuine Fractals. --- b { font-weight: normal; }

          S Offline
          S Offline
          sarabjs
          wrote on last edited by
          #4

          Any ideas where I could read more about better resizing methods, esp any designed for enlarging images ? Thanks!

          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