stumpy_gif

Write (animated) GIF images image-processing gif
0.1.1 released
stumpycr/stumpy_gif
19 3 1
stumpycr

stumpy_gif

Interface

  • StumpyGIF.write(frames : Array(Canvas), path, 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

Usage

Writing

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 GIF image with an animated color gradient GIF image with an animated color gradient

(See examples/ for more examples)

Color Quantization Methods

  • Use Websafe colors
  • Median Split
  • NeuQuant

References

stumpy_gif:
  github: stumpycr/stumpy_gif
  version: ~> 0.1.1
License MIT
Crystal none

Authors

Dependencies 1

  • stumpy_core ~> 1.8
    {'git' => 'https://github.com/stumpycr/stumpy_core.git', 'version' => '~> 1.8'}

Development Dependencies 1

  • minitest ~> 0.3.1
    {'git' => 'https://github.com/ysbaddaden/minitest.cr.git', 'version' => '~> 0.3.1'}
Last synced .
search fire star recently