2004.07.29 21:07 "[Tiff] writing to a pipe (better error message needed?)", by Jay Berkenbilt

2004.07.29 21:07 "[Tiff] writing to a pipe (better error message needed?)", by Jay Berkenbilt

There's a 3.5-year-old debian "wishlist" bug that boils down to someone wanting to be able to create tiff files to a pipe. I understand the tiff file format well and know that it is full of offsets and lengths, making writing a tiff file in one pass impossible without potentially caching the whole image in memory, particularly when compression is being used.

The error message that libtiff gives when you try to write to a pipe is something like 'Error writing data for field "DocumentName"' (or whichever field it's writing). It might be more clear if TIFFFdOpen (or some lower-level function) immediately failed if you use a non-seekable file descriptor.

In any case, I was going to post to this bug explaining TIFF files inherently can't be written to a pipe without having the application or library use temporary files or cache large amounts of data in RAM. I believe that, if it's really important to be able to write a TIFF to a pipe, it would be the job of the application to manage this rather than the TIFF library. Would it be safe to say that the libtiff maintainers have no intention of supporting writing a tiff file to a pipe? If so, I'll mention that in my response as well, but I wanted to check first because I don't like to put words in people's mouths. :-) I may also mention to the user that the PNG file format was designed with writing to a pipe as a design goal, so if this functionality is required, they may want to consider that format. In fact, I think the user in question doesn't care about this and was just confused by the error message.

For what it's worth, I'm gradually going through all the libtiff "bugs" in the debian bug tracking system in an effort to get them all cleared out, so I may be asking a handful of questions like this and/or sending in patches over the next couple of weeks. I'm hoping that the release schedule for libtiff is such that this will help get any of these issues resolved before the next release. If you think a release is coming up really soon, let me know and I'll accelerate my efforts.

Jay Berkenbilt <ejb@ql.org>
http://www.ql.org/q/