gmex v0.1.1 Gmex
A simple wrapper for GraphicsMagick in Elixir.
Summary
Functions
Returns a keywords list with information about the image like width, height, size, format and quality
Opens image source
Apply a GraphicsMagick option to the given image
Saves the modified image
Types
gmex_error :: {:error, any}
image :: {:ok, Gmex.Image}
Functions
Specs
get_info(image) :: {:ok, image_info} | gmex_error
Returns a keywords list with information about the image like width, height, size, format and quality.
Specs
open(String.t) :: image | gmex_error
Opens image source.
Example
iex> Gmex.open( "test/images/blossom.jpg" )
{ :ok, %Gmex.Image{ image: "test/images/blossom.jpg", options: [] } }
iex> Gmex.open( "non-existing.png" )
{ :error, :enoent }
Specs
option(image, Option) :: image | gmex_error
Apply a GraphicsMagick option to the given image.
Example
iex> Gmex.open( "test/images/blossom.jpg" )
iex> |> Gmex.option( :negate )
iex> |> Gmex.option( { :resize, 50, 50 } )
iex> |> Gmex.option( :strip )
iex> |> Gmex.option( { :format, "jpg" } )
{ :ok, %Gmex.Image{ image: "test/images/blossom.jpg", options: [ "-negate", "-resize", "50x50", "-strip", "-format", "jpg" ] } }
List of available options:
Option | GraphicsMagick |
---|---|
:plus_adjoin | +adjoin |
:adjoin | -adjoin |
{ :blur, radius, sigma } | -blur radiusxsigma |
{ :blur, radius } | -blur radius |
{ :crop, width, height, x_offset, y_offset } | -crop widthxheight+x_offset+y_offset |
{ :crop, width, height } | -crop widthxheight |
{ :edge, edge } | -edge edge |
{ :extent, width, height, x_offset, y_offset } | -extent widthxheight+x_offset+y_offset |
{ :extent, width, height } | -extent widthxheight |
flatten | -flatten |
{ :fill, color } | -fill color |
:strip | -strip |
:flip | -flip |
{ :format, format } | -format format |
{ :gravity, gravity } | -gravity gravity |
magnify | -magnify |
plus_matte | +matte |
matte | -matte |
negate | -negate |
{ :opaque, color } | -opaque color |
{ :quality, quality } | -quality quality |
{ :resize, width, height } | -resize widthxheight |
{ :resize, percents } | -resize percents% |
{ :rotate, degrees } | -rotate degrees |
{ :size, width, height } | -size widthxheight |
{ :size, width, height, offset } | -size widthxheight+offset |
{ :thumbnail, width, height } | -thumbnail widthxheight |
{ :thumbnail, percents } | -thumbnail percents% |
{ :transparent, color } | -transparent color |
{ :type, type } | -type type |
{ :custom, [ arg1, arg2, arg3... ] } | arg1 arg2 arg3 … |
Specs
save(image, String.t) :: image | gmex_error
Saves the modified image
Example
iex> Gmex.open( "test/images/blossom.jpg" )
iex> |> Gmex.save( "newimage.jpg" )
{ :ok, nil }