Less Common Functions

ANNOTATE

Adds text to an image

{
    "name":"annotate",
    "params":{
        "text":"my_text",
        "color":"#ffffff"
    }
}

Optional:

  • x: X offset (defaults to 0)
  • y: Y offset (defaults to 0)
  • color: Color of text (defaults to '#ffffff')
  • style: "normal" or "italic" or "oblique" (defaults to "normal")
  • kerning: Distance between letters (defaults based on font)
  • font_weight: "bold" or "normal" (defaults to "bold")
  • font_family: Font of text (defaults to 'Arial')
    Need an Open Source font added? Write us at [email protected]
  • point_size: Size of text (defaults to 32)
  • stretch: Stretch value (Normal/Expanded/Condensed)
  • stroke: Color of stroke (defaults to "transparent")
  • dropshadow_color: Adds a dropshadow of a specified color
  • dropshadow_offset: Pixels down/right for dropshadow, if dropshadow_color is set.
    (defaults to 3)
  • gravity: Placement of text (defaults to 'CenterGravity')

Required:

  • text: Text to be placed on image

EXAMPLE




BACKGROUND COLOR

Sets the default background color for transparent images

{
  "name": "background_color",
  "params": {}
}

Optional:

  • color : Color you want for the background color (defaults to ‘#ffffff’)



NO OP

A no-op functions which just outputs the input as an image

{    
	"name":"no_op",    
  "params":{}
}



PAD RESIZE TO FIT

Resize to fit, but will pad to keep the aspect ratio. So for example, if you are going from a 3:4 aspect ratio to a 3:2 aspect ratio, this method will assure the result the desired output size, and pad the filled in area with a specified color.

932
{
  "name": "pad_resize_to_fit",
  "params": {
    "width": "300",
    "height": "200"
  }
}

Required:

  • width : Output width
  • height : Output height

Optional:

  • only_resize_larger : If set to true will only resize image if it’s larger then width or height (default false)
  • color : Color for the padding (defaults to “#ffffff”)
  • gravity : Location of output relative to padding (defaults to center)

EXAMPLE