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ö <michael@petoe.me>
Target
  • visto from src/cli.cr

Dependencies

Runtime Dependencies

  • stumpy_png~> 4.2github: l3kn/stumpy_png

README

# visto

[![Travis](https://img.shields.io/travis/petoem/visto.svg?style=flat-square)](https://travis-ci.org/petoem/visto)
[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](https://github.com/petoem/visto/blob/master/LICENSE) 

visto (**Vis**ual **Sto**rage) 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`:

```yaml
dependencies:
  visto:
    github: petoem/visto
```

#### `Visto.encode(data : Bytes) : Canvas`
Returns a [StumpyCore](https://github.com/stumpycr/stumpy_core)::Canvas that contains data.

#### `Visto.decode(canvas : Canvas) : Bytes`
Returns the extracted bytes from the canvas.

## Example

<img style="image-rendering: pixelated;" src="example.png" width="150">

> The file [random.txt](spec/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](https://github.com/petoem) Michael Petö - creator, maintainer