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.
i suspect a nogo programmatically, and then bring in windows...
s/EPIPE/SIGPIPE/, but otherwise, I agree. :)
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. :)