Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: saving Images

  1. #1

    saving Images

    Hi!
    I would like to know if there is a(n)(easy)way to save images(of different extensions) to a file and to load them back from the file ..(without using rar or other archive file types)

  2. #2

    Re: saving Images

    I think you need some sort of editor to do that, i.e. unDelphix allows you to save all images in dxImageList to one *.dxg file. You can then load, add and remove images from the dxg file. Don't know how to program such an editor though
    Wake up from the dream and live your life to the full

  3. #3

    Re: saving Images

    Hmm.. Undelphix is only a good choice when you are allready using it in your game/application.

    You could try this one:

    http://www.delphizip.org/

    Or this one:

    http://www.dellapasqua.com/delphizlib/


    Or check a few of these:

    http://www.torry.net/pages.php?s=99

    Hope this helps.
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

  4. #4

    Re: saving Images

    Well so much for easy solutions..but thnx for the help I will try them soon..
    Still is there no other way ?

  5. #5

    Re: saving Images

    You could use google to find even more zib/compression libraries, or you could write your own package system. If you don't have a lot of demands, this can be simple. If you want to have directories within the package, it becomes a lot harder (I can tell, I've been there. ).

    You could write your own package loader/saver by using streams. This may be a good choice as you will learn alot. Check this link If you want to get crackin with Streams:

    http://delphi.about.com/od/vclusing/l/aa110803a.htm


    You just make a TFileStream object to create a new file (or open an existing one). After that, you can feed your data to the stream, or read data from it. Usually, you start with a little header telling you what and how many data is stored in the file. By using the header data, you can read chunks of data and treat them as seperate files. You could then load the files into your application. (Remember that many objects like TBitmap have a LoadFromStream and SaveToStream method).

    Just take a look at streams if you find it interesting. If you want a simple example of how to use them, just ask.
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

  6. #6

    Re: saving Images

    This is much better thnx !
    A few exaples would be nice ..

  7. #7

    Re: saving Images

    Have a browse through this excellent site. Chances are, your question has been asked before (most of mine have been ) Maybe not exactly what you're looking for, but here's what i dug up:

    Link
    Link
    Link

    Windows Vista x64 Ultimate<br />AMD Athlon x64 4000+<br />Codegear Delphi 2009, Delphi 2007, Borland Delphi 7

  8. #8

    Re: saving Images

    Hi!
    I am having a little trouble (as always ) with loading a picture from a file to a tpicture variable..
    Here's what I have problem's with:
    Code:
    type
    tpack=record
     kep:tpicture;
     nr:integer;
     hsize:int64;
     fsize:int64;
    end;
    var 
    lpack:array [1..9999] of tpack;
    ...
     lpack[1].nr:=1;
    lpack[1].kep.LoadFromFile('D:\integralas1.jpg');
    //It won't let me load the picture.. it gives an error saying "raised exception Class
    //EAccessViolation with message 'Access violation at adress 00404107 in module .. read 
    //of adress 00000000'" I think it's because I have to "initialize" the tpicture 
    //component somehow but I don't know how ..
     lpack[1].hsize:=sizeof (lpack[1]);
     lpack[1].fsize:=sizeof (lpack[1]);
    ...
    Can you please help ?

  9. #9

    Re: saving Images

    Initialize:

    lpack[1].kep := TPicture.Create;

    Then later when you want to clean up and free memory;

    lpack[1].kep.Free;
    ZGameEditor - Develop 64kb games for Windows.
    Thrust for Vectrex - ROM-file and 6809 source code.

  10. #10

    Re: saving Images

    thnx a lot !
    Btw will this write the picture to the file ?(in case of large pictures as well.. )
    Code:
    strm.Writebuffer(lpack[1],sizeof (tpack));

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

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