Using existing image compression codecs

The enb library offers a set of codecs that can be installed
  • via the enb plugin install command-line interface (CLI).

  • via the enb.plugins.install() method within your scripts via

Installation via enb plugin install

In the CLI, you can list the available codecs by performing a search among all available plugins:

enb plugin list codec

And then, for instance to install the zip plugin one can simply run:

enb plugin install zip installation_folder

Installation via enb.plugins.install()

You can add a line like the following to your script so that it automatically installs and imports a plugin

enb.plugins.install("huffman")
enb.plugins.install(name, target_dir=None, overwrite=False, automatic_import=True)

Install an Installable by name into target_dir.

Parameters:
  • name – name of the installable (e.g., plugin) to be installed. Run enb plugin list in the CLI to get a list of all available installables.

  • target_dir – If target_dir is None, it is set to plugins/<plugin_name> by default.

  • overwrite – If overwrite is False and target_dir already exists, no action is taken.

  • automatic_import – If True, the installable is imported as a module.

Codec availabily

Different codecs are available for different data types and bit depths. If you want to test all publicly available codecs, you can install the test-codecs plugin with:

enb plugin install test-codecs tc

and then run the test_all_codecs.py script, e.g., with:

python tc/test_all_codecs.py

It will produce a set of plots describing the codecs and the data types for which they are available. A snapshot of this output is shown next

_images/DictNumericAnalyzer_type_to_availability_groupby-group_label_line.png