Data Compression/Executable Compression/ECM file on Linux

How to compress or decompress an ECM file on GNU/Linux?

Description
The ECM format allows you to reduce the size of a typical CD image file (ISO, BIN, CDI, NRG, CCD, or any other format that uses raw sectors). It works by eliminating the Error Correction/Detection Codes (ECC/EDC) from each sector whenever possible. The encoder automatically adjusts to different sector types and automatically skips any headers it encounters. Since the data skipped is nearly impossible to compress with traditional tools, the resulting ECM file will compress far better than the raw CD image.

ECM on Linux
Install the "ecm" package, it is available in Debian repositories:

https://packages.debian.org/stretch/ecm

apt install "ecm"

Compress
use "ecm-compress" command

EXAMPLES ecm-compress foo.bin strips the  ECC/EDC  data  from  the  foo.bin CD image and save the resulting file as foo.bin.ecm

ecm-compress foo.img foobar strips the ECC/EDC data from the foo.img CD  image  and  save the resulting file as foobar

run "man ecm-compress" for more information

De-compress
use "ecm-uncompress" command

EXAMPLES ecm-uncompress foo.bin.ecm regenerate the ECC/EDC data from foo.bin.ecm and save the resulting CD image as foo.bin

ecm-uncompress foo.img.ecm foobar regenerate the ECC/EDC data from foo.img.ecm and save the resulting CD image as foobar

run "man ecm-uncompress" for more information