would be nice to be able to verify the header before running it through decompression. i can easily get a hold of 150MP images and they can be a pain to hack on.
If you just want to read in the header data, it should be sufficient if you just piped the decompressed data to your "header-checker" like this
bzip2 < giantimage.ff.bz2 | header-checker
Inside the header checker, you just read in the first 16 Bytes ("farbfeld" + width + height), do whatever you like with the data and exit.
bzip2 would then receive an SIGPIPE. Up until this point, it would have probably filled the pipe buffer (~16K) with data and then blocked.
Receiving SIGPIPE, I'm certain bzip2(1) will cancel any further decompression attempts.
You see, you could even carry on with your image-processing in case you like the header data and want to proceed. The nice pipe-system already handles that for you. :)
I think what he's saying is that you must decompress the entire thing before you can look at those headers. If all you want is the width and height, you still might have to decompress a gigantic image, which is lots of wasted work and time.