Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/LangPham/gi
Gi is a library for manipulating Graphics Interfacing. Use utility mogrify, identify, ... of GraphicsMagick to resize, draw on base images....
https://github.com/LangPham/gi
Last synced: 2 months ago
JSON representation
Gi is a library for manipulating Graphics Interfacing. Use utility mogrify, identify, ... of GraphicsMagick to resize, draw on base images....
- Host: GitHub
- URL: https://github.com/LangPham/gi
- Owner: LangPham
- License: mit
- Created: 2021-06-14T00:38:51.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-12-22T07:23:48.000Z (about 1 year ago)
- Last Synced: 2024-10-03T17:46:47.890Z (3 months ago)
- Language: Elixir
- Homepage: https://hexdocs.pm/gi
- Size: 3.68 MB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- fucking-awesome-elixir - gi - An Elixir wrapper for GraphicsMagick command line. (Images)
- awesome-elixir - gi - An Elixir wrapper for GraphicsMagick command line. (Images)
README
# Gi
[![Elixir CI](https://github.com/LangPham/gi/actions/workflows/elixir.yml/badge.svg)](https://github.com/LangPham/gi/actions/workflows/elixir.yml)
![Hex.pm](https://img.shields.io/hexpm/l/gi)
![Hex.pm](https://img.shields.io/hexpm/v/gi)Gi is a library for manipulating Graphics Interfacing. Use utility mogrify, identify, ... of GraphicsMagick to resize, draw on base images....
## Requirements
You must have [GraphicsMagick](http://www.graphicsmagick.org/) installed of course.## Features
Utilities for image:
* Resize image to width x height with ratio (WxH)
```elixir
Gi.open("example.jpg") # example.jpg (300x200)
|> Gi.gm_mogrify(resize: "200x100")
|> Gi.save() # => example.jpg (150x100)
```
* Resize image to width x height (WxH!)
```elixir
Gi.open("example.jpg") # example.jpg (300x200)
|> Gi.gm_mogrify(resize: "200x100!")
|> Gi.save() # => example.jpg (200x100)
```
* Format image to jpg, png, webp, ...
```elixir
Gi.open("example.jpg")
|> Gi.gm_mogrify(format: "webp")
|> Gi.save() # => create new file "example.webp"
```
* Draw text on image text x,y 'string'
```elixir
Gi.open("example.jpg")
|> Gi.gm_mogrify(draw: "text 150,150 'Theta.vn'")
|> Gi.save()
```* Draw image on image "image Over x,y,w,h file"
```elixir
Gi.open("example.jpg")
|> Gi.gm_mogrify(draw: "image Over 100,100,200, 200 dir/logo.a")
|> Gi.save()
```* Multi utilities
```elixir
Gi.open("example.jpg")
|> Gi.gm_mogrify([resize: "300x200", draw: "text 150,150 'Theta.vn'"])
|> Gi.save()
```* Combine multiple images into one
```elixir
Gi.open("frame.png")
|> Gi.gm_composite(["background.jpg","result.png"])
```## Installation
If [available in Hex](https://hex.pm/docs/publish), the package can be installed
by adding `gi` to your list of dependencies in `mix.exs`:```elixir
def deps do
[
{:gi, "~> 0.1.0"}
]
end
```Documentation [https://hexdocs.pm/gi](https://hexdocs.pm/gi).