stumpy_gif

Version, currently 0.1.13 versions

github.com/stumpycr/stumpy_gif

Write GIF images in pure Crystal

19 stars
1 dependent
License: MIT

Nothing has been indexed for 0.1.1 yet. The tag is recorded, its shard.yml has not been read, so the manifest and dependency list below are empty because they are unknown rather than because they are absent.

Installation

# Add this to your shard.yml
dependencies:
  stumpy_gif:
    github: stumpycr/stumpy_gif
    version: ~> 0.1.1

Then run:

shards install

shard.yml

No shard.yml has been indexed for 0.1.1. You can read it on the repository.

Dependencies

Unknown: the shard.yml for this version has not been read yet.

README

This README is the one indexed from the repository at its latest ref, not from the tag for this version.

# stumpy_gif

## Interface

* `StumpyGIF.write(frames : Array(Canvas), path_or_io, delay_between_frames = 10)`
  saves a list of frames (canvasses) as a GIF image file,
  `delay_between_frames` is in 1/100 of a second
* `Canvas` and `RGBA` from [stumpy_core](https://github.com/stumpycr/stumpy_core)

## Usage

### Writing

``` crystal
require "stumpy_gif"
include StumpyGIF

frames = [] of Canvas

(0..5).each do |z|
  canvas = Canvas.new(256, 256)

  (0..255).each do |x|
    (0..255).each do |y|
      color = RGBA.from_rgb_n([x, y, z * 51], 8)
      canvas[x, y] = color
    end
  end

  frames << canvas
end

StumpyGIF.write(frames, "rainbow.gif")
```

Left to right: Websafe, median split, NeuQuant

![GIF image with an animated color gradient](examples/rainbow_websafe.gif)
![GIF image with an animated color gradient](examples/rainbow_median_split.gif)
![GIF image with an animated color gradient](examples/rainbow_neuquant.gif)

(See `examples/` for more examples)

## Color Quantization Methods

* Use Websafe colors
* Median Split
* NeuQuant

## References

* [Kohonen Neural Networks for Optimal Colour Quantization](http://members.ozemail.com.au/~dekker/NeuQuant.pdf)

## Contributors

Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds/all-contributors#emoji-key)):

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore -->
| [<img src="https://avatars1.githubusercontent.com/u/2060269?v=4" width="100px;"/><br /><sub><b>Leon</b></sub>](http://leonrische.me)<br /> | [<img src="https://avatars1.githubusercontent.com/u/26842759?v=4" width="100px;"/><br /><sub><b>Sam</b></sub>](https://github.com/Demonstrandum)<br /> | [<img src="https://avatars2.githubusercontent.com/u/11375246?v=4" width="100px;"/><br /><sub><b>Stepan Melnikov</b></sub>](https://github.com/unn4m3d)<br />[💻](https://github.com/stumpycr/stumpy_gif/commits?author=unn4m3d "Code") | [<img src="https://avatars1.githubusercontent.com/u/1196822?v=4" width="100px;"/><br /><sub><b>Dmitry Bochkarev</b></sub>](https://github.com/DmitryBochkarev)<br />[💻](https://github.com/stumpycr/stumpy_gif/commits?author=DmitryBochkarev "Code") |
| :---: | :---: | :---: | :---: |
<!-- ALL-CONTRIBUTORS-LIST:END -->

This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome!