Thread: Image Store

  1. #1
    Registered User
    Join Date
    Dec 2005
    Posts
    2

    Image Store

    Hi

    Can anyone offer any pointers on how to achieve the following using vc++?

    Any help would really be appreciated.

    I am displaying two images on a dialog and I would like to save them into one file. Once they are in the file, I would like to add application "settings" into the file.

    Afterwards, how can I retrieve and parse the data so I can display the images again?


    I think I can use the code below to perform the first part but I get stuck with the second part of the process (loading and parsing the resulting file)

    Code:
    ifstream reader(fImagePath, ios::in | ios::binary);
    ofstream writer(fileName, ios::app | ios::binary);
    					
    writer << reader.rdbuf();
    reader.close();
    writer.close();
    Thanks
    Ben

  2. #2
    carry on JaWiB's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    1,972
    Sounds like you'll have to define your own file format to do this. For example, you might use the first four bytes of the new file to store the size (in bytes) of the first image.

    In other words, you need to have some way to specify where the first image ends and the other begins, unless you want to simply fuse the two images together, which would require some knowledge of the image file format.
    "Think not but that I know these things; or think
    I know them not: not therefore am I short
    Of knowing what I ought."
    -John Milton, Paradise Regained (1671)

    "Work hard and it might happen."
    -XSquared

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem reading tiff image files?
    By compz in forum C++ Programming
    Replies: 9
    Last Post: 10-30-2009, 04:17 AM
  2. Replies: 1
    Last Post: 05-27-2009, 12:46 PM
  3. Simple Image Processing
    By ejohns85 in forum C++ Programming
    Replies: 4
    Last Post: 03-19-2009, 12:10 PM
  4. Replies: 6
    Last Post: 03-03-2005, 03:52 AM
  5. Replies: 4
    Last Post: 03-02-2003, 09:12 AM