dcsimg
Results 1 to 7 of 7

Thread: Saving Image to non-image file (Mixed)

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Feb 2004
    Location
    Croatia
    Posts
    23

    Exclamation Saving Image to non-image file (Mixed)

    How can I save image from PictureBox to another file, but not to image file. I'm trying to save a file with text and graphics, so I can later "extract" image part of the file and load it again in picture box.

    Is there something about Streams?
    When to use Image.FromStream for loading images???

    Example: You have CD Cover Editor and you want to save background image and text to one file.

  2. #2
    Frenzied Member Mike Hildner's Avatar
    Join Date
    Jul 2002
    Location
    Des Moines, NM
    Posts
    1,690
    I've seen file formats like this, but have never created one. How about putting the text first, then a null character, then the image? You could have multiple text/image records in one file if you delimit them.

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Feb 2004
    Location
    Croatia
    Posts
    23
    Yes, but how can I load that image from the file to PictureBox, since this ain't image file?

  4. #4
    Frenzied Member Mike Hildner's Avatar
    Join Date
    Jul 2002
    Location
    Des Moines, NM
    Posts
    1,690
    Honestly, I haven't tried, but I guess you would start the stream at byte x, then read to the end of file (or delimiter). Byte x would immediately follow the null character which signifies the end of the string.

    I'm sure this is possible, and if I don't get too many trick-or-treaters soon, I'll try some code out.

    Mike

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Feb 2004
    Location
    Croatia
    Posts
    23
    The problem is, I don't know how to create this Stream. I know only how to load it ".. = Image.FromStream..."

    If the image bytes in this file are between 40 and 1200, how to insert this part of the file into stream?

    I need the code?

    Please give me a tip if you find something!

  6. #6
    Frenzied Member Asgorath's Avatar
    Join Date
    Sep 2004
    Location
    Saturn
    Posts
    2,036
    Hi Kiko

    You could use the popular uuencode to convert the picture into text and store them on the text files.

    Regards
    Jorge
    "The dark side clouds everything. Impossible to see the future is."

  7. #7

    Thread Starter
    Junior Member
    Join Date
    Feb 2004
    Location
    Croatia
    Posts
    23
    That could work!

    Can you paste me the code how to read from binary file to string?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width