Image compression and decompression using SVD
Installation
Install CLI using pipx:
pipx install git+https://github.com/toadharvard/svdi-cli.git
Or
pipx install svdi
Usage example
svdi compress --in-file=images/rafiq.bmp --out-file=images/liquidated.svdi --compression=3 --method=numpy
svdi decompress --in-file=images/liquidated.svdi --out-file=images/rafiq2.bmp
ls -l ./images
Available SVD functions
rsvd— N Halko, P. G Martinsson, and J. A Tropp. Finding structure with randomness: Probabilistic algorithms for constructing approximate matrix decompositions. Siam Review, 53(2):217-288, 2011.numpy— NumPy'snp.linalg.svdfunction.pcafast— H. Li, G. C. Linderman, A. Szlam, K. P. Stanton, Y. Kluger, and M. Tygert. Algorithm 971: An implementation of a randomized algorithm for principal component analysis. Acm Transactions on Mathematical Software, 43(3):1-14, 2017.pi— Power iterations method. URL: http://www.cs.yale.edu/homes/el327/datamining2013aFiles/07_singular_value_decomposition.pdf
Available commands
svdi --help
svdi compress --help
svdi decompress --help
SVDI Format
The CLI uses a simple binary format for storing SVD results in .svdi files.
Each .svdi file consists of a header followed by the SVD results for each channel:
- Header
- Signature: A fixed 4-byte sequence b'SVDI' to identify the file format.
- Dimensions: Three 4-byte unsigned integers representing the shape of the matrices: m, n, and k.
- m: The number of rows in each U matrix.
- n: The number of columns in each Vh matrix.
- k: The size of each S vector, and the number of columns in U and rows in Vh.
- Channel Data
Repeated for each channel (NUMBER_OF_CHANNELS):
- U Matrix: A matrix of size m * k, with elements stored as 32-bit floats in row-major order.
- S Vector: A vector of length k, with elements stored as 32-bit floats.
- Vh Matrix: A matrix of size k * n, with elements stored as 32-bit floats in row-major order.
Licence
See the details of the license in the LICENCE file.
Metadata
Release files for svdi 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| svdi-1.0.1.tar.gz | 6.1 kB | Without provenance | Details for svdi-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| svdi-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for svdi-1.0.1-py3-none-any.whl |
Total release size: 14.9 kB
Release files / svdi-1.0.1.tar.gz
| Download URL | svdi-1.0.1.tar.gz |
|---|---|
| Size | 6.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ce6b23f3e1b22692ef7271782a86f9d0cac6bf5fb4e3b66473974dbc75813935
|
|
BLAKE2b-256 checksum How to use checksums |
86adbd82d23ab39950c9e6d1c58363a4a9dd29a86a4bfd95eae0ba4d45571ed5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.0.0 CPython/3.12.3
|
Release files / svdi-1.0.1-py3-none-any.whl
| Download URL | svdi-1.0.1-py3-none-any.whl |
|---|---|
| Size | 8.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fc125c23d87f803a48f82986dba7e1b56fb87fe2c197bf7d6b633fa474a46903
|
|
BLAKE2b-256 checksum How to use checksums |
329c42cec105bff045e6666c5906449384c30ac43cc0cadf650e328f6bdb1bb9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.0.0 CPython/3.12.3
|
Security for svdi 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.