Re: Writing several images into a single binary file



Logan Shaw wrote:

There is no way this can ever possibly work reliably. The pixel data
is arbitrary data and can include any arbitrary sequence of bytes.

OK, I was slowly getting convinced of this too.

I would use a library that already knows how to read and write a standard
image format.


Is there a library that allows you to write several images in the same file? images with pixels of 32 bits?

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.

Well I tried and it didn't work, but I'll give it another try. Would you suggest to read one image at the time from the file or, instead, read everything in a single buffer and then extract the images from there? The total size of the file usually ends up between one and two megabytes.

Thanks.
G
.



Relevant Pages

  • Re: re:Reversibly Censor Images
    ... JPEG is out, GIF is too ugly. ... PNG for example, if you randomize a part of the image,the PNG file ... some text inside the image format. ... 50 pixels fromt he left edge, 90 pixels from the top edge, with a height ...
    (sci.crypt)
  • Re: convert images
    ... ie if oldimage.pgm has pixels ... JPEG uses a lossy compression algorithm, i.e. the image loses quality and ... you want get the exact values back you have to use another image format. ...
    (comp.lang.python)
  • Exporting in image format
    ... I have a A4 visio page that I want to export in an image format to be sen on a web page. ... I'm exporting it in two version one in 500x300 pixels and one in 1000*600 pixels. ...
    (microsoft.public.visio.general)