Faster Image Save in C#

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vipergt023
    New Member
    • Aug 2008
    • 27

    Faster Image Save in C#

    Hello,

    Does anyone know if there is a faster way to save BMPs in C#?

    Currently, I'm using this:

    MemoryStream ms = new MemoryStream();
    picture.Save(ms , System.Drawing. Imaging.ImageFo rmat.Png);

    But it's taking around 80 ms. Is there a way to improve that? I'm writing a screen capture application, so coupled with the time it takes to capture the desktop (around 80 ms also), it's not as responsive as I'd like it to be. I'm also sending the images off over the network, so smaller file sizes are better.

    TIA.

    Vinoj
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    I would guess that the time consumptions occurs durring the PNG encoding process

    Comment

    • vipergt023
      New Member
      • Aug 2008
      • 27

      #3
      I've tried the different options (tif, jpeg, gif, etc) and that has the best time/size/quality ratio.

      Comment

      • joedeene
        Contributor
        • Jul 2008
        • 579

        #4
        i've read somewhere on another forum about using a memory stream could take longer to load the bitmap, rather than writing a physical file to the harddrive, and he noticed a less speed issue when not using the debugger. so try that maybe ?

        joedeene

        Comment

        • vipergt023
          New Member
          • Aug 2008
          • 27

          #5
          That's a good idea to start with. I'll try that - compiling in release mode and trying to get some stats from that.

          Comment

          Working...