Implementation of a simple version of the JPG format.
The dct2 folder contains a simple benchmark over different implementations of the Discrete Cosine Transform 2-dimensional algorithm.
The jpug folder contains a CLI program that can be used for testing a simple version of the JPG format, whose details are described in doc/project.pdf.
The three parameters used are:
-
$F \in \mathbb{N},$ $F > 0$ : dimension of the blocks; -
$d \in \mathbb{N},$ $0 < d \le 2F - 1$ : first antidiagonal to exclude; -
$mode \in {L, RGB}$ : modality used in compression. L represents a gray-scale image and RGB a colored image.
The program defines a custom format called jpug which is used to save the 'compressed' files. Images formats supported are:
- Encoding:
- Input: bmp
- Output: jpug
- Decoding:
- Input: jpug
- Output: bmp
The usage of the CLI is:
Main.py [path [param_1] [param_2] [param_3]]
where:
-
.Main.pyruns the CLI based program; -
.Main.py pathtries to encode or decode the file specified atpathaccording to the file extension; -
.Main.py path modetries to encode or decode according to specifiedmode, which can be 'RGB' or 'L'; -
.Main.py path F dtries to encode or decode according to the specified parametersFandd, with the constraints-
$F > 0$ ; -
$0 < d \le 2F - 1$ ;
-
-
.Main.py path F d modetries to encode or decode with the specified parametersFdand the specifiedmode.
Where not specified, the following default values are used:
$F = 8$ $d = 8$ - mode = RGB
List of all the dependecies to run the program (can be installed with pip install):
- numpy: Linear algebra for python;
- PIL: Python Image Library;
- pickle: Python object serialization;
- fft: Fast Fourier Transform (dct2 implementation);
- matplotlib: Large image visualization
To install all the dependencies run:
pip install -r requirements.txt