ProductPromotion
Logo

Elixir

made by https://0x3d.site

GitHub - elixir-mogrify/mogrify: Image processing in Elixir (ImageMagick command line wrapper)
Image processing in Elixir (ImageMagick command line wrapper) - elixir-mogrify/mogrify
Visit Site

GitHub - elixir-mogrify/mogrify: Image processing in Elixir (ImageMagick command line wrapper)

GitHub - elixir-mogrify/mogrify: Image processing in Elixir (ImageMagick command line wrapper)

Mogrify

Build Status Module Version Hex Docs Total Download License Last Updated

An Elixir wrapper for ImageMagick command line.

Documentation: https://hexdocs.pm/mogrify/

Requirements

You must have ImageMagick installed of course.

Installation

Add this to your mix.exs file, then run mix do deps.get, deps.compile:

def deps do
  {:mogrify, "~> 0.9.3"}
end

Configuration

Configure the ImageMagick executable paths (optional):

Configure mogrify command:

config :mogrify, mogrify_command: [
  path: "magick",
  args: ["mogrify"]
]

Configure convert command:

config :mogrify, convert_command: [
  path: "magick",
  args: ["convert"]
]

Configure identify command:

config :mogrify, identify_command: [
  path: "magick",
  args: ["identify"]
]

Examples

Thumbnailing:

import Mogrify

# This does operations on an original image:
open("input.jpg") |> resize("100x100") |> save(in_place: true)

# save/1 creates a copy of the file by default:
image = open("input.jpg") |> resize("100x100") |> save
IO.inspect(image) # => %Image{path: "/tmp/260199-input.jpg", ext: ".jpg", ...}

# Resize to fill
open("input.jpg") |> resize_to_fill("450x300") |> save

# Resize to limit
open("input.jpg") |> resize_to_limit("200x200") |> save

# Extent
open("input.jpg") |> extent("500x500") |> save

# Gravity
open("input.jpg") |> gravity("Center") |> save

Converting:

import Mogrify

image = open("input.jpg") |> format("png") |> save
IO.inspect(image) # => %Image{path: "/tmp/568550-input.png", ext: ".png", format: "png"}

Getting info:

import Mogrify

image = open("input.jpg") |> verbose
IO.inspect(image) # => %Image{path: "input.jpg", ext: ".jpg", format: "jpeg", height: 292, width: 300}

Getting reduced info in a "lighter" way (uses less memory):

import Mogrify

info = identify("input.jpg")
IO.inspect(info) # => %{format: "jpeg", height: 292, width: 300}

Using custom commands to create an image with markup:

import Mogrify

%Mogrify.Image{path: "test.png", ext: "png"}
|> custom("size", "280x280")
|> custom("background", "#000000")
|> custom("gravity", "center")
|> custom("fill", "white")
|> custom("font", "DejaVu-Sans-Mono-Bold")
|> custom("pango", ~S(<span foreground="yellow">hello markup world</span>))
|> create(path: ".")

Plasma backgrounds:

import Mogrify

%Mogrify.Image{path: "test.png", ext: "png"}
|> custom("size", "280x280")
|> custom("seed", 10)
|> custom("plasma", "fractal")

Creating new images: See mogrify_draw for an example of generating a new image from scratch.

Changelog

See the changelog for important release notes between Mogrify versions.

Copyright and License

Copyright (c) 2014 Dmitry Vorotilin

Mogrify source code is licensed under the MIT License.

Articles
to learn more about the elixir concepts.

Resources
which are currently available to browse on.

mail [email protected] to add your project or resources here 🔥.

FAQ's
to know more about the topic.

mail [email protected] to add your project or resources here 🔥.

Queries
or most google FAQ's about Elixir.

mail [email protected] to add more queries here 🔍.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory