phronmophobic / clogif

Create gifs in clojure!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

clogif

Create gifs in clojure!

Built with FFmpeg and clj-media.

Rationale

This library is a small wrapper around clj-media that offers a simplified API for creating GIFs using best practices.

Dependency

com.phronemophobic/clogif {:mvn/version "1.4"}

Usage

(require '[com.phronemophobic.clogif :as gif])
(gif/save-gif!
 (gif/graphics->media
  (fn [g frameno]
    (.setColor g java.awt.Color/white)
    (.fillRect g 0 0 100 100)
    (.setColor g java.awt.Color/black)
    (.drawString g (str "Hello World " frameno) 5 50))
  (range 24))
 "hello-world.gif")

Hello World

Membrane Compatible!

(require '[membrane.java2d :as java2d]
         '[membrane.ui :as ui])
(gif/save-gif!
 (gif/graphics->media
  java2d/draw-to-graphics
  {:width 100
   :height 18}
  (eduction
   (map (fn [frameno]
          [(ui/filled-rectangle [1 1 1]
                                100 18)
           (ui/label (str "membrane: " frameno))]))
   (range 24)))
 "membrane.gif")

Membrane gif

License

Copyright © 2023 Adrian

The contents of this repository may be distributed under the Apache License v2.0 or the GPLv2.

About

Create gifs in clojure!

License:Apache License 2.0


Languages

Language:Clojure 100.0%