cimbar icon indicating copy to clipboard operation
cimbar copied to clipboard

Does this project only support txt files? I tried encoding a PDF and then decoding it, but the decoded PDF cannot be opened.

Open fighter-01 opened this issue 11 months ago • 4 comments

fighter-01 avatar Jan 17 '25 06:01 fighter-01

It should be independent of datatype. What you're running into is possibly file size related.

sz3 avatar Jan 17 '25 07:01 sz3

I tested a 66.9 KB PDF file

fighter-01 avatar Jan 17 '25 07:01 fighter-01

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

fighter-01 avatar Jan 17 '25 07:01 fighter-01

A few things:

  1. 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.
  2. since it's pretty annoying to need the exact 9 frames in order to decode successfully, cimbar uses fountain codes (pass the --fountain option 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.

sz3 avatar Jan 19 '25 09:01 sz3