Skip to content

Commit

Permalink
Merge pull request #17 from nitsujw/gravity
Browse files Browse the repository at this point in the history
Allow gravity to be set on resize_to_fill
  • Loading branch information
talklittle committed Jun 15, 2016
2 parents 3e4b179 + 1448797 commit 8a65929
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ Thumbnailing:

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

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

```

Converting:
Expand Down
7 changes: 7 additions & 0 deletions lib/mogrify.ex
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,13 @@ defmodule Mogrify do
%{image | operations: image.operations ++ [extent: params]}
end

@doc """
Sets the gravity of the image
"""
def gravity(image, params) do
%{image | operations: image.operations ++ [gravity: params]}
end

@doc """
Resize the image to fit within the specified dimensions while retaining
the original aspect ratio. Will only resize the image if it is larger than the
Expand Down

0 comments on commit 8a65929

Please sign in to comment.