Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vssekorin/clyaksa
Clojure library for pixel-art and simple work with images
https://github.com/vssekorin/clyaksa
clojure jvm pixel-art
Last synced: about 1 month ago
JSON representation
Clojure library for pixel-art and simple work with images
- Host: GitHub
- URL: https://github.com/vssekorin/clyaksa
- Owner: vssekorin
- Created: 2018-10-11T08:58:15.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-01-18T08:36:07.000Z (about 6 years ago)
- Last Synced: 2024-12-15T22:05:49.449Z (about 1 month ago)
- Topics: clojure, jvm, pixel-art
- Language: Clojure
- Homepage:
- Size: 15.6 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# clyaksa
[![Clojars Project](https://img.shields.io/clojars/v/com.vssekorin/clyaksa.svg)](https://clojars.org/com.vssekorin/clyaksa)
### Create new image
```clojure
(new-image 1000 :rgb) ;; 1000x1000 rgb image
(new-image 600 800 :argb) ;; 600x800 argb image
```Enabled image types:
- `:custom`
- `:rgb`
- `:argb`
- `:argb-pre`
- `:bgr`### Save/Load image
Save:
```clojure
(save-image image "image.jpg")
(save-image image "image.jpg" :jpg)
```Load:
```clojure
(load-image :file "image.png") ;; load image from filesystem
(load-image :url "google.com/image.png") ;; load image by url(load-image "image.png") ;; image loaded from filesystem by default
```### Image data
```clojure
(get-height image) ;; get height of the image
```
```clojure
(get-width image) ;; get width of the image
```### Drawing
Color is int value.
Set pixel:
```clojure
(set-pixel image 200 300 color) ;; return changed image
```Get pixel:
```clojure
(get-pixel image 55 55) ;; return color of pixel
```Swap pixels in one image:
```clojure
(swap-pixel image x1 y1 x2 y2) ;; return changed image
```Swap pixels between two image:
```clojure
(swap-pixel image1 image2 x1 y1 x2 y2) ;; return array of changed images: [image1 image2]
```