estimate zlib compression ratio?



Is there a fast way to estimate the zlib compression ratio for a file
(or any stream) without actually doing the compression?

For example, I need to send files over a socket, and some files are
jpegs, which don't compress that well, but other files are large text
documents with good compression ratios. I'd like to selectively
compress the files based on an estimated compression ratio.

Thanks

.