Gm
Idiomatic GraphicsMagick wrapper for Elixir.
Prerequisites
Make sure you have GraphicsMagick installed on your system.
-
On Mac OS X:
brew install graphicsmagick -
On Arch Linux:
pacman -S graphicsmagick -
On Ubuntu:
apt-get install graphicsmagick
Installation
Add gm to your list of dependencies in mix.exs:
def deps do
[{:gm, "~> 0.0.1"}]
end
and run mix deps.get.
Usage
Creating a thumbnail
Gm.open("large.jpg")
|> Gm.resize(100, 100)
|> Gm.write("thumbnail.jpg") # => :okWriting text over an image
Gm.open("image.jpg")
|> Gm.font("Fira-Sans.ttf")
|> Gm.point_size(24)
|> Gm.fill("red")
|> Gm.draw_text(400, 100, "This is a caption")
|> Gm.write("captioned.jpg") # => :okMore examples coming soon.
License
MIT