Skip to content

horooka/rust_image-codec

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tool for images coding and chipering

!!!Warning!!!

during encoding input image is rewritten with a new pallete of a specified size (256 colors max)

Tool features:

  • Encoding as palette-based image with the Floyd-Steinberg dithering. Palette is generated with median-cut algorithm
  • AES128 encryption-decryption (length-preserving) for pixels data available (header data stays unchanged)
  • Zstandard compression for pixels data available
  • Multi-threaded processing

Build:

cargo build --release

Usage:

exe [options] [input_file_path] [output_file_path] [palette_size(2..256 inclusively)] [base64url_key]

options:
    - i - info mode: input - existing [input_file_path], output - stderr
    - e - encode mode: input - existing [input_file_path], [palette_size], output - saved [output_file_path] or stderr
    - d - decode mode: input - existing [input_file_path], [palette_size], output - saved [output_file_path] or stderr
    - c - encryption-decryption flag
    - z - compression-decompression flag: requires additional [base64url_key] arg at last position
    - g - 16bytes base64url stdout key gen

Examples:

  • image for encoding: image.png

  • ./target/release/rust_image-codec ecz image.png encoded.bin 256 dozR7XYsRBdDmHhHtRmCJg: *saved ./encoded.bin file

  • ./target/release/rust_image-codec dcz encoded.bin decoded.png dozR7XYsRBdDmHhHtRmCJg: *saved ./decoded.png image

  • decoded image: decoded.png

Encoded header format (before compression):

  • first three bytes - image dimensions (both are 1-based)
  • fourth byte - palette size (1-based)
  • next 3 * {palette_size} bytes - rgb8 colors
  • rest of bytes - pixels data as byte-sized palette indices

Some details:

  • max image dimensions are 4096x4096

About

Cli tool for image codec and ciphering

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages