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. Save a System.Drawing.Graphics graphic as *.bmp

Save a System.Drawing.Graphics graphic as *.bmp

Scheduled Pinned Locked Moved C#
graphics
3 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.
  • M Offline
    M Offline
    Manfr3d
    wrote on last edited by
    #1

    Hello guys! I want to save a System.Drawing.Graphics graphic as a *.bmp file, and tried it using the StreamWriter. I know this from saving text to a *.txt file, but found out, that this doesn't work with System.Drawing.Graphics graphics. Has anyone an idea how this could work, I didn't find anything useful in the MSDN library. Thanjs and best wishes.

    P 1 Reply Last reply
    0
    • M Manfr3d

      Hello guys! I want to save a System.Drawing.Graphics graphic as a *.bmp file, and tried it using the StreamWriter. I know this from saving text to a *.txt file, but found out, that this doesn't work with System.Drawing.Graphics graphics. Has anyone an idea how this could work, I didn't find anything useful in the MSDN library. Thanjs and best wishes.

      P Offline
      P Offline
      pmarfleet
      wrote on last edited by
      #2

      The following steps should work: 1. Create a new instance of a System.Drawing.Bitmap object. 2. Derive a Graphics object from your bitmap by calling its FromImage method. 3. Perform your drawing operations using the Graphics object. 4. Call the Dispose method on your Graphics object. 4. Save your image to a file by calling the Save method on your bitmap object. Hope this helps.

      Paul Marfleet "No, his mind is not for rent To any God or government" Tom Sawyer - Rush

      M 1 Reply Last reply
      0
      • P pmarfleet

        The following steps should work: 1. Create a new instance of a System.Drawing.Bitmap object. 2. Derive a Graphics object from your bitmap by calling its FromImage method. 3. Perform your drawing operations using the Graphics object. 4. Call the Dispose method on your Graphics object. 4. Save your image to a file by calling the Save method on your bitmap object. Hope this helps.

        Paul Marfleet "No, his mind is not for rent To any God or government" Tom Sawyer - Rush

        M Offline
        M Offline
        Manfr3d
        wrote on last edited by
        #3

        Thanks for your help, now it works :)

        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