madam.image module

class madam.image.FlipOrientation[source]

Bases: enum.Enum

Represents an axis for image flip operations.

HORIZONTAL = 0

Horizontal axis

VERTICAL = 1

Vertical axis

class madam.image.PillowProcessor[source]

Bases: madam.core.Processor

Represents a processor that uses Pillow as a backend.

auto_orient(asset)[source]

Creates a new asset whose essence is rotated according to the Exif orientation.

Parameters:asset – Asset with Exif metadata
Returns:Asset with rotated essence
convert(asset, mime_type)[source]

Creates a new asset of the specified MIME type from the essence of the specified asset.

Parameters:
  • asset – Asset whose contents will be converted
  • mime_type – Target MIME type
Returns:

New asset with converted essence

flip(asset, orientation)[source]

Creates a new asset whose essence is flipped according the specified orientation.

Parameters:
  • asset – Asset whose essence is to be flipped
  • orientation – axis of the flip operation
Returns:

Asset with flipped essence

resize(asset, width, height, mode=<ResizeMode.EXACT: 0>)[source]

Creates a new Asset whose essence is resized according to the specified parameters.

Parameters:
  • asset – Asset to be resized
  • width – target width
  • height – target height
  • mode – resize behavior
Returns:

Asset with resized essence

transpose(asset)[source]

Creates a new image asset whose essence is the transpose of the specified asset’s essence.

Parameters:asset – Image asset whose essence is to be transposed
Returns:New image asset with transposed essence
class madam.image.ResizeMode[source]

Bases: enum.Enum

Represents a behavior for image resize operations.

EXACT = 0

Resized image exactly matches the specified dimensions

FILL = 2

Resized image is resized to completely fill the specified dimensions

FIT = 1

Resized image is resized to fit completely into the specified dimensions