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. How do I save Image with a different resolution?

How do I save Image with a different resolution?

Scheduled Pinned Locked Moved C#
question
4 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.
  • A Offline
    A Offline
    aei_totten
    wrote on last edited by
    #1

    How do I save Image with a different resolution? I am using Image.Save(...) I think it might have to do with Image.PropertyItems and using SetPropertieItem, but I am only finding info on id, length, value, and type.

    C 1 Reply Last reply
    0
    • A aei_totten

      How do I save Image with a different resolution? I am using Image.Save(...) I think it might have to do with Image.PropertyItems and using SetPropertieItem, but I am only finding info on id, length, value, and type.

      C Offline
      C Offline
      ChrisKo 0
      wrote on last edited by
      #2

      I haven't done much with the System.Drawing namespace, but a quick look and I found the SizeConverter Class. http://msdn2.microsoft.com/en-us/library/system.drawing.sizeconverter_members(VS.80).aspx[^]

      A 1 Reply Last reply
      0
      • C ChrisKo 0

        I haven't done much with the System.Drawing namespace, but a quick look and I found the SizeConverter Class. http://msdn2.microsoft.com/en-us/library/system.drawing.sizeconverter_members(VS.80).aspx[^]

        A Offline
        A Offline
        aei_totten
        wrote on last edited by
        #3

        I tried this... Bitmap b = new Bitmap(currentImage); b.SetResolution(150, 150); b.Save(saveImageDialog.FileName, System.Drawing.Imaging.ImageFormat.Tiff); and it didn't work, but I don't know why. I will look at the size converter class. Thanks.

        G 1 Reply Last reply
        0
        • A aei_totten

          I tried this... Bitmap b = new Bitmap(currentImage); b.SetResolution(150, 150); b.Save(saveImageDialog.FileName, System.Drawing.Imaging.ImageFormat.Tiff); and it didn't work, but I don't know why. I will look at the size converter class. Thanks.

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

          aei_totten wrote:

          I tried this... Bitmap b = new Bitmap(currentImage); b.SetResolution(150, 150); b.Save(saveImageDialog.FileName, System.Drawing.Imaging.ImageFormat.Tiff); and it didn't work, but I don't know why.

          I think that it worked just fine, but it didn't do what you throught that it would do. The SetResolution method does set the resolution of the image, but what you want to do is to change the size of the image. Create a new Bitmap object with the size that you want. Create a Graphics object for that bitmap using the Graphics.FromImage method. Use the DrawImage method to draw your image onto the bitmap with the desired size.

          --- single minded; short sighted; long gone;

          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