Re: Writing several images into a single binary file
- From: Logan Shaw <lshaw-usenet@xxxxxxxxxxxxx>
- Date: Wed, 29 Aug 2007 20:35:16 -0500
Giff wrote:
I have been successfully writing and reading images to/from binary files just with the image size on the first row and then all the pixel values sequentially, through the read/write functions (I use C++).
Now, I would like to join few images in a single file, separating the single images from each other by a text comment.
There is no way this can ever possibly work reliably. The pixel data
is arbitrary data and can include any arbitrary sequence of bytes.
What would be your suggestion to solve this problem?
I would use a library that already knows how to read and write a standard
image format.
But if for some reason you have a compelling reason to invent your own
format, you are already storing the width in pixels of the first image,
so based on that data, you should be able to compute the offset to
the next image without relying on an inherently unreliable method like
looking for newlines.
- Logan
.
- Follow-Ups:
- References:
- Prev by Date: Re: New language idea - you guys have any feedback?
- Next by Date: Re: How to make sure my in-memory db does not flush corrupt page to disk?
- Previous by thread: Re: Writing several images into a single binary file
- Next by thread: Re: Writing several images into a single binary file
- Index(es):
Relevant Pages
|