Uncommon Functions

These are the lesser of used functions. These are useful for very specialized operations.

APPEND

Append images together either horizontally or vertically

{
  "name": "append",
  "params": {
    "other_images": "http://placekitten.com/421/540,http://placekitten.com/422/540",
    "vertical": false
  }
}

Optional:

  • vertical : Whether images are appended vertically(true) or horizontally(false)
  • other_images : Comma separated list of urls to other images

EXAMPLE:




AUTO ENHANCE

Automatically ‘enhances’ (magic wand) an image.

{
  "name": "auto_enhance"
}



BACKGROUND COLOR

Sets a transparent background color to be a solid (useful when converting pngs to jpgs)

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

Optional:

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

BLUR

Blurs an image using Guassian blur.

{
  "name": "blur"
}

Optional:

  • sigma : Gaussian sigma of blur (defaults to 1.0)
  • radius : Gaussian radius of blur (defaults to 0.0)}



CROP

Crop an image to a specific size. Note: This is not used very often. You are probably looking for "resize_to_fill"

{
  "name": "crop",
  "params": {
    "x": 0,
    "y": 0,
    "width": 10,
    "height": 10
  }
}

Optional:

  • height: Height of resulting image
  • x: X offset
  • y: Y offset
  • preserve_aspect_if_smaller: If source image is smaller than target size, crop smaller image to still be same aspect ratio (default false)
  • gravity: Sets the starting gravity of where the x,y will offset from

Required:

  • width: Width of resulting image

DESKEW

Deskews an image (if it's slightly misaligned). Useful for images of documents.

{
  "name": "deskew",
  "params": {}
}

Optional:

  • threshold : Maximum threshold percentage for deskewing (Default = 0.40)


DENSITY

Changes the exif density and will resize based on current set density

{   
  "name":"density",    
  "params":
    {        
      "dpi":"200"    
    }
}

Required:

  • dpi : Sets the DPI of the image


DESPECKLE

Reduces the speckle noise while preserving the edges

{
  "name": "despeckle",
  "params": {}
}



DISSOLVE

Composites with transparency

{
  "name": "dissolve",
  "params": {
    "src": "http://mysite/image_to_overlay",
    "src_percentage": 0.3
  }
}

Required:

  • src : Url of image you wants composited on top of original image

Optional:

  • scale_to_fit : { “width” : width, “height” : height }, to automatically scale src to fit within specific size. Can also be percentage if suffixed with >#/li###
  • scale_to_fill : { “width” : width, “height” : height }, to automatically scale src to fill the area defined. Can also be percentage if suffixed with >#/li###
  • scale_to_match : “true” or “false” to automatically scale src to the same size as current image (defaults to false)
  • as_mask : “true” or “false” to use src as a greyscale mask (defaults to false)
  • x : X offset of where to place image on original image
  • y : Y offset of where to place image on original image
  • gravity : Instead of x,y you could use gravity.
  • src_percentage : Percentage (0.0-1.0) of alpha on overlayed image (default 0.25)
  • dst_percentage : Percentage (0.0-1.0) of alpha on original (bottom) image (default 1.0)

EXAMPLE:




IMAGE GRID

Builds a grid of input images

{
	"name": "image_grid",
	"params": {
		"images": ["https://s3.amazonaws.com/img.blitline/skysmall.jpg", "https://unsplash.it/200/300/?random", "https://unsplash.it/200/300/?random", "https://unsplash.it/200/300/?random", "https://unsplash.it/200/300/?random", "https://unsplash.it/200/300/?random"],
		"cell_width": 200,
		"cell_height": 200,
		"columns": 3,
		"padding": 2,
		"color": "#ffda5a"
	}
}

Required:

  • images : Array of images to be placed into the grid
  • cell_width : Width of cell to output
  • cell_height : Height of cell to output
  • columns : Number of columns to display

Optional:

  • padding : Padding between cells
  • color : Color of padding

EXAMPLE




LINE

Draws a linear line between two points.

{
    "name":"line",
    "params":{
        "x":10,
        "y":10,
        "x1":50,
        "y1":50,
        "width":1,
        "color":"#ffffff",
        "opacity":1.0,
        "line_cap":"butt"
    }
}

Optional:

  • width: Width of line (default 1)
  • color: Color of line (default "#ffffff")
  • opacity: Opacity of line (default 1.0)
  • line_cap: How the line ends. Only relevant for widths > 1. Two possible options are "butt"(default) and "round"(rounds ends).

Required:

  • x: Starting X coordinate
  • y: Starting Y coordinate
  • x1: Ending X coordinate
  • y1: Ending Y coordinate

LIQUID RESCALE

Uses seam carving to reduce image size

{
  "name": "liquid_rescale",
  "params": {
    "width": 1000,
    "height": 1000
  }
}

Required:

  • width : Target width
  • height : Target height

Optional:

  • delta_x : Maximum seam transversal step (default 0)
  • rigidity : Bias for non-straight seams (default 0)

EXAMPLE




PAD

Add empty space to one side or all sides of image (Useful for centering an image on a new canvas color)

{
  "name": "pad",
  "params": {
    "size": 30
  }
}

Required:

  • size : Thickness of padding

Optional:

  • gravity : Location of padding (default “CenterGravity”)
  • color : Color of padding (default “#ffffff”)

EXAMPLE




PIXELATE

Pixelates an area on an image (blurs out an area and makes it look like pixels are blurred)

1438
{
  "name": "pixelate",
  "params": {
    "size": 30
  }
}

Optional:

  • x : X position of starting area on image (default 0)
  • y : Y position of starting area on image (default 0)
  • width : Width of area to pixelate (defaults to width of original image)
  • height : Height of area to pixelate (defaults to height of original image)
  • amount : 1-100 value representing the amount to pixelate

EXAMPLE




ROTATE

Rotates the image.

{
  "name": "rotate",
  "params": {
    "amount": 90
  }
}

Required:

  • amount : The number of degrees to rotate the image.


SCRIPT

Run your own scripts on Blitline cloud servers. Perfect for using your own ImageMagick scripts

{
  "name": "script",
  "params": {
    "bash_string": "convert input.png -trim output.png"
  }
}

Optional:

  • bash_string : String representation of a bash file that will execute on the server (requires NO ‘executable’ or ‘files)
  • files : Extra files to download before the script is run (requires ‘executable’)
  • executable : Command line to run script (requires ‘files’)

Example: http://www.blitline.com/docs/scripts




TRIM

Makes a ‘best guess’ crop to upper-left and lower-right corners. For example, if you have an image with a bunch of white border around it, and you want it cropped to only where there something other than the border color.

{
  "name": "trim",
  "params": {}
}

Optional:

  • fuzz : Fuzz the trimming edge. For JPEGs, due to compression or anti-aliasing often times edges aren’t a clean line. The “fuzz” values allows you to trim with a slight extra fuzz around the trim area. (Defaults to 0.0, valid values are 0.0 - 1.0)



UNSHARP MASK

Sharpens an image

{
  "name": "unsharp_mask",
  "params": {}
}

Optional:

  • sigma : Gaussian operator (defaults to 1.0)
  • radius : Gaussian operator (defaults to 0.0)
  • amount : The percentage of the blurred image to be added to the receiver, specified as a fraction between 0 and 1.0 (defaults to 1.0)
  • threshold : The threshold needed to apply the amount, specified as a fraction between 0 and 1.0 (defaults to 0.05)}