dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: How to store an image inside a file ?

  1. #1
    Join Date
    Feb 2017
    Posts
    4

    Question How to store an image inside a file ?

    Hi !

    I try to create a file that contains some images (in JPEG or PNG format) and some other binary data.

    To store the images, I plan to use GDI+ and the Image::Save() method. So I need an IStream object.

    To store the other binary data, I plan to use the standard ofstream::write() method. So I need an ofstream object.

    Are these two objects (IStream and ofstream) compatible ? And how can I find one from the other ?

    Thanks for your help.

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    19,456

    Re: How to store an image inside a file ?

    Why IStream?
    Why not just use this overloaded method:
    Code:
    HRESULT Save(
        LPCTSTR pszFileName,
        REFGUID guidFileType = GUID_NULL) const throw();
    Victor Nijegorodov

  3. #3
    Join Date
    Feb 2017
    Posts
    4

    Re: How to store an image inside a file ?

    Thanks VictorN for your answer.

    The Save(pszFileName,guidFileType) method fits well when you have to store only an image in the file.
    But, in my case, I have to write some other data before and after the image, in the same file. So I need to write the image in an opened file.

Tags for this Thread

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)