For your first command:
gzip -c /dev/sda > img.gz
For your second command: gunzip -c img.gz > /dev/sda
are what I suspect the blog post would recommend.