Compress 'dd' Output

LZMA
(Compress) Disk -> LZMA
dd if=/dev/sda bs=1M | xz --format=lzma > out.lzma

(Compress) File -> LZMA
xz --format=lzma -c file.img > out.lzma

(Decompress) LZMA -> File
xz -F lzma -d -k -c out.lzma > out

(Decompress) LZMA -> Disk
xz -F lzma -d -k -c out.lzma | dd of=/dev/sda bs=1M

gzip
(Compress) Disk -> gzip
dd if=/dev/sda bs=1M | gzip > out.gzip

(Compress) File -> gzip
gzip -c file.img > out.gzip

(Decompress) gzip -> Disk
gzip -d -c out.gzip | dd of=/dev/sda bs=1M

(Decompress) gzip -> File
gzip -d -c out.gzip > out

Compression comparison w/1GB (uncompressed) data
LZMA -> 6 minutes to compress
LZMA -> 17 seconds to decompress
Compressed to 200MB

gzip -> 35 seconds to compress
gzip -> 7 seconds to decompress
Compressed to 300MB