The image-codec
is a simple CLI tool to encode and decode PGM images. Among others, following methods are used:
- Variable Block Size Encoding
- Block-adaptive transform selection using Discrete Sinus Transformation (DST-VII)
- Rate-distortion optimized quantization
- Entropy coding
- Context-based adaptive binary arithmetic coding (CABAC)
- Optimized encoder control with Lagrange optimization
To install the image-codec
package for production purposes please, follow the subsequent instructions. All instructions also work for Python's and Anaconda's virtual environments.
If you want to use git clone
together with pip
, you can run:
> git clone https://github.com/marisanest/image-codec.git
> cd image-codec
Optionally, If you want to install a specific branch, please check out the wanted branch first:
> git checkout <branch-name>
Then install the package:
> pip install .
If you want to use pip
only, you can run:
> pip install git+https://github.com/marisanest/image-codec
Optionally, If you want to install a specific branch, please run the following command:
> pip install git+https://github.com/marisanest/image-codec@<branch-name>
To install the image-codec
package for development purposes please, follow the subsequent instructions.
If you want to use git clone
together with pip
, you can run:
> git clone https://github.com/marisanest/image-codec.git
> cd image-codec
Optionally, If you want to install a specific branch, please check out the wanted branch first:
> git checkout <branch-name>
Then install the package:
> pip install -e .[development]
For simple usage of the image-codec
for image encoding run:
> image-codec encode <input-path> <output-path>
and for image decoding run:
> image-codec decode <input-path> <output-path>
For further details please run:
> image-codec --help
Usage: image-codec [OPTIONS] COMMAND [ARGS]...
A Image Codec CLI to en- and decode images.
Options:
--version Show the version and exit.
--help Show this message and exit.
Commands:
decode Decode image.
encode Encode image.
Comparing the image-codec
with a classical JPEG codec using PSNR (Peak Signal-to-Noise Ratio) measurement, the following quality improvements for an example image can be observed:
This library is available under the MIT License.