Does this project only support txt files? I tried encoding a PDF and then decoding it, but the decoded PDF cannot be opened.
It should be independent of datatype. What you're running into is possibly file size related.
I tested a 66.9 KB PDF file
The encoding and decoding commands I used above are:python -m cimbar.cimbar --encode 444.pdf encoded.png python -m cimbar.cimbar encoded.png --output=33.pdf --ecc=30
A few things:
- since a cimbar frame can only hold ~7500 bytes of real data, the 66900 byte file is going to end up split across 9 different images. Decoding will require 9 frames to be present.
- since it's pretty annoying to need the exact 9 frames in order to decode successfully, cimbar uses fountain codes (pass the
--fountainoption for both encode/decode) to let us generate "N" frames, and decode the data with any distinct 9 frames. But again, this only works with fountain codes enabled.
... and either way, you'll need 9 imagesi to decode the data.
i. with fountain codes enabled, we also do some zstd compression. If the pdf compresses well enough, it might be (for example) 3 or 4 instead of 9.