https://github.com/phronmophobic/clogif
Create gifs in clojure!
https://github.com/phronmophobic/clogif
clojure gif
Last synced: 11 months ago
JSON representation
Create gifs in clojure!
- Host: GitHub
- URL: https://github.com/phronmophobic/clogif
- Owner: phronmophobic
- License: apache-2.0
- Created: 2023-10-21T22:31:26.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-01-23T20:43:03.000Z (about 2 years ago)
- Last Synced: 2025-02-27T05:02:51.995Z (11 months ago)
- Topics: clojure, gif
- Language: Clojure
- Homepage:
- Size: 60.5 KB
- Stars: 10
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# clogif
Create gifs in clojure!
Built with [FFmpeg](https://ffmpeg.org/) and [clj-media](https://github.com/phronmophobic/clj-media).
## Rationale
This library is a small wrapper around `clj-media` that offers a simplified API for creating GIFs using best practices.
## Dependency
```edn
com.phronemophobic/clogif {:mvn/version "1.4"}
```
## Usage
```clojure
(require '[com.phronemophobic.clogif :as gif])
```
```clojure
(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")
```

### [Membrane](https://github.com/phronmophobic/membrane) Compatible!
```clojure
(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")
```

## License
Copyright © 2023 Adrian
The contents of this repository may be distributed under the Apache License v2.0 or the GPLv2.