Saving bitmap as text in C#

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Atli
    Recognized Expert Expert
    • Nov 2006
    • 5062

    Saving bitmap as text in C#

    Hi.

    I've created a small photoshop wanabe application, that i've designed so users can draw and edit images using layers, similar to what photoshop does. Except, for now, all my layers are bitmaps.

    What I'm trying to do now is save all those layers, so users can create a project, save it and then reopen it with all the layers intact.

    My current theory is to take each layer and turn each byte of the bitmap into a hex value, pump all that into a string and put it into a xml file.

    I see no problem with that except, I might be working with several large bitmaps (1280 * 1024.. ish) and even tho I would be using unsafe code and pointers and whatnot, this would probbly take up a lot of resources and time.
    Im not looking for help with doing that, I can manage that.

    But if anybody has another, preferably better, way to do this. I would really like to hear about it.

    Thanks
  • kenobewan
    Recognized Expert Specialist
    • Dec 2006
    • 4871

    #2
    I agree xml would get a bit cumbersome with this operation. Here is an article that outlines an alternative:
    Tame the BLOB

    Comment

    • Motoma
      Recognized Expert Specialist
      • Jan 2007
      • 3236

      #3
      You could always perform compression on the xml after converting it.

      Comment

      • Atli
        Recognized Expert Expert
        • Nov 2006
        • 5062

        #4
        Thank you guys for your help.

        I would love to be able to use SQL to do this, but I need all this data to go into a single file on the hdd, so users can move their work arround.
        My MsSQL skills are limited, so I'm not sure if this can be done using that.

        Compressing the file is a good idea, Im looking into that right now.

        Thanks again guys.

        Comment

        Working...