StumpyPNG/GIF

crystal

Table of Contents

StumpyPNG

Crystal library for reading and writing png files, with support for Adam7 interlacing and all kinds of color types.

Source code on Github: stumpycr/stumpy_png

include StumpyPNG

canvas = Canvas.new(256, 256)

(0...255).each do |x|
  (0...255).each do |y|
    # RGBA.from_rgb_n(values, bit_depth) is an internal helper method
    # that creates an RGBA object from a rgb triplet with a given bit depth
    color = RGBA.from_rgb_n(x, y, 255, 8)
    canvas[x, y] = color
  end
end

StumpyPNG.write(canvas, "rainbow.png")

StumpyGIF

Crystal library for creating (animated) gif files.

Source code on Github: stumpycr/stumpy_gif

rainbow_neuquant.gif
Figure 1: Rainbow GIF

If you have an idea how this page could be improved or a comment send me a mail.