View Source Mogrify (mogrify v0.9.3)

Link to this section Summary

Functions

Makes a copy of original image.

Creates or saves image.

Extends the image to the specified dimensions.

Converts the image to the image format you specify.

Sets the gravity of the image.

Returns the histogram of the image

Provides "identify" information about an image.

Provides "identify" information about an image with raw access attribute. Example: identify(file_path, format: "'%[orientation]'")

Sets a pixel cache resource limit, in the form of a space-separated string (e.g. "memory 30mb").

Sets a pixel cache resource limit.

Opens image source.

Changes quality of the image to desired quality.

Resizes the image with provided geometry.

Resize the image to fit within the specified dimensions while retaining the aspect ratio of the original image.

Resize the image to fit within the specified dimensions while retaining the original aspect ratio.

Saves modified image.

Provides detailed information about the image.

Link to this section Functions

Link to this function

add_option(image, option)

View Source

Makes a copy of original image.

Link to this function

create(image, opts \\ [])

View Source

Creates or saves image.

Uses the convert command, which accepts both existing images, or image operators. If you have an existing image, prefer save/2.

options

Options

  • :path - The output path of the image. Defaults to a temporary file.
  • :in_place - Overwrite the original image, ignoring :path option. Default false.
  • :buffer - Pass true to write to Collectable in Image.buffer instead of file.
  • :into - Used with :buffer to specify a Collectable. Defaults to "". See System.cmd/3.
Link to this function

custom(image, action, options \\ nil)

View Source

Extends the image to the specified dimensions.

Link to this function

extract_histogram_data(entry)

View Source

Converts the image to the image format you specify.

Sets the gravity of the image.

Returns the histogram of the image

Runs ImageMagick's histogram:info:- command.

Results are returned as a list of maps where each map includes keys red, blue, green, hex and count.

examples

Examples

iex> open("test/fixtures/rbgw.png") |> histogram
[
  %{"alpha" => 255, "blue" => 255, "count" => 400, "green" => 0, "hex" => "#0000ff", "red" => 0},
  %{"alpha" => 255, "blue" => 0, "count" => 225, "green" => 255, "hex" => "#00ff00", "red" => 0},
  %{"alpha" => 255, "blue" => 0, "count" => 525, "green" => 0, "hex" => "#ff0000", "red" => 255},
  %{"alpha" => 255, "blue" => 255, "count" => 1350, "green" => 255, "hex" => "#ffffff", "red" => 255}
]

Provides "identify" information about an image.

Link to this function

identify(file_path, list)

View Source

Provides "identify" information about an image with raw access attribute. Example: identify(file_path, format: "'%[orientation]'")

Link to this function

image_operator(image, operator)

View Source

Sets a pixel cache resource limit, in the form of a space-separated string (e.g. "memory 30mb").

Link to this function

limit(image, type, value)

View Source

Sets a pixel cache resource limit.

Opens image source.

Changes quality of the image to desired quality.

Resizes the image with provided geometry.

Link to this function

resize_to_fill(image, params)

View Source

Resize the image to fit within the specified dimensions while retaining the aspect ratio of the original image.

If necessary, crop the image in the larger dimension.

Link to this function

resize_to_limit(image, params)

View Source

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 specified dimensions. The resulting image may be shorter or narrower than specified in the smaller dimension but will not be larger than the specified values.

Saves modified image.

options

Options

  • :path - The output path of the image. Defaults to a temporary file.
  • :in_place - Overwrite the original image, ignoring :path option. Default false.
Link to this function

temporary_path_for(image)

View Source

Provides detailed information about the image.

This corresponds to the mogrify -verbose output which is similar to identify. It does NOT correspond to identify -verbose which prints out much more information.