Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/stumpycr/stumpy_gif
Write GIF images in pure Crystal
https://github.com/stumpycr/stumpy_gif
crystal gif image-processing
Last synced: 20 days ago
JSON representation
Write GIF images in pure Crystal
- Host: GitHub
- URL: https://github.com/stumpycr/stumpy_gif
- Owner: stumpycr
- License: mit
- Created: 2016-09-22T02:07:04.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2019-10-10T10:23:07.000Z (about 5 years ago)
- Last Synced: 2024-11-12T18:38:32.929Z (30 days ago)
- Topics: crystal, gif, image-processing
- Language: Crystal
- Homepage:
- Size: 109 KB
- Stars: 19
- Watchers: 4
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-crystal - stumpy_gif - Write (animated) GIF images (Image processing)
README
# 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 StumpyGIFframes = [] 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
endframes << canvas
endStumpyGIF.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)):
| [
Leon](http://leonrische.me)
| [
Sam](https://github.com/Demonstrandum)
| [
Stepan Melnikov](https://github.com/unn4m3d)
[💻](https://github.com/stumpycr/stumpy_gif/commits?author=unn4m3d "Code") | [
Dmitry Bochkarev](https://github.com/DmitryBochkarev)
[💻](https://github.com/stumpycr/stumpy_gif/commits?author=DmitryBochkarev "Code") |
| :---: | :---: | :---: | :---: |This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome!