visto

Version, currently master branch1 version
  • master branchlatestFeb 23, 2018

github.com/petoem/visto

Store bytes as an image

6 stars
0 dependents
License: MIT

Installation

# Add this to your shard.yml
dependencies:
  visto:
    github: petoem/visto
    branch: master

master is a branch, not a release, so this tracks it rather than pinning a version.

Then run:

shards install

shard.yml

Crystal
0.24.1
License
MIT
Author
Michael Petö
Target
  • visto from src/cli.cr

Dependencies

Runtime Dependencies

README

visto

Travis GitHub license

visto (Visual Storage) allows you to store Bytes as an image.

Build

> crystal build src/cli.cr --release -o visto

Usage

Command Line

> visto --help
Usage: visto [FILE] [arguments]
    -e, --encode                     Encode data into image
    -d, --decode                     Decode data from image
    -o FILE, --output=FILE           Specifies the output file path
    -v, --version                    Show version number
    -h, --help                       Show this help
> 
> # to store a file as an image, run ...
> visto myawesome.pdf -e -o image.png
> # to get your file ...
> visto image.png -d -o my.pdf

Library

Add this to your application's shard.yml:

dependencies:
  visto:
    github: petoem/visto

Visto.encode(data : Bytes) : Canvas

Returns a StumpyCore::Canvas that contains data.

Visto.decode(canvas : Canvas) : Bytes

Returns the extracted bytes from the canvas.

Example

The file random.txt as an image.

Each pixel corresponds to a byte. Bytes are written from left to right, top to bottom.

The first 8 pixels represents a UInt64 number, which tells how many bytes long the stored data is. After this data pixels follow. Any excess pixels at the end are filled up with black.

Contributing

  1. Fork it ( https://github.com/petoem/visto/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

  • petoem Michael Petö - creator, maintainer