Home

Functions

These are the operations supported by Blitline during image processing.Learn more about using functions

Example:

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

Live Sample

PARAMS:  Required / Optional


NameDescription
"text"Text to be placed on image
"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 'Helvetica') <br>Need an Open Source font added? Write us at support@blitline.com
"point_size"Size of text (defaults to 32)
"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. <br>(defaults to 3)
"gravity" Placement of text (defaults to 'CenterGravity')

Example:

{
    "name":"append",
    "params":{
        "vertical":false
    }
}

Live Sample

PARAMS:  Required / Optional


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

Example:

{
    "name":"blur"
}

PARAMS:  Required / Optional


NameDescription
"sigma"Gaussian sigma of blur (defaults to 1.0)
"radius"Gaussian radius of blur (defaults to 0.0)}

Example:

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

PARAMS:  Required / Optional


NameDescription
"color"Color you want for the background color (defaults to '#ffffff')

Example:

{
    "name":"composite",
    "params":{}
}

Live Sample

PARAMS:  Required / Optional


NameDescription
"src"Url of image you wants composited with original image
"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. (Gravity param overrides x,y values)
"composite_op"How composite is to be applied. Defaults to "OverCompositeOp" (which means it will just be layed on top of original image). See "Composite Ops" section below for more options

Example:

{
    "name":"contrast",
    "params":{}
}

PARAMS:  Required / Optional


NameDescription
"sharpen"Contrast is increased if true (defaults to false)

Example:

{
    "name":"contrast_stretch_channel",
    "params":{
        "black_point":10
    }
}

PARAMS:  Required / Optional


NameDescription
"black_point"Burn at most this many pixels. Specify an absolute number of pixels as a numeric value
"white_point"Burn at most this many pixels. Specify an absolute number of pixels as a numeric value. If not given defaults to all_points-black_point

Example:

{
    "name":"convert_command",
    "params":{}
}

Live Sample

PARAMS:  Required / Optional


NameDescription
"<Convert Options>"Each param is an option. If the option has a value, set the value, otherwise leave as empty string.

Example:

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

Live Sample

PARAMS:  Required / Optional


NameDescription
"width"Width of resulting image
"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

Example:

{
    "name":"crop_to_square",
    "params":{}
}

Live Sample

PARAMS:  Required / Optional


NameDescription
"gravity"Gravity of resulting crop (default CenterGravity)

Example:

{
    "name":"delete_profile",
    "params":{}
}

PARAMS:  Required / Optional


NameDescription
"name"Name of the profile to remove (or * to remove wildcard)

Example:

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

PARAMS:  Required / Optional


NameDescription
"threshold"Maximum threshold percentage for deskewing (Default = 0.40)

Example:

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

PARAMS:  Required / Optional


NameDescription
"dpi"Sets the DPI of the image

Example:

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

Example:

{
    "name":"ellipse",
    "params":{
        "origin_x":100,
        "origin_y":100,
        "ellipse_width":50,
        "ellipse_height":30,
        "stroke_width":5,
        "color":"#ffffff",
     }
}

Live Sample

PARAMS:  Required / Optional


NameDescription
"origin_x"Center X coordinate
"origin_y"Center Y coordinate
"ellipse_width"Width of ellipse
"ellipse_height"Height of ellipse
"color"Color of stroke (default "#ffffff")
"stroke_width"Width of ellipse perimeter(stroke) line (default 0, no stroke)
"stroke_opacity"Opacity of stroke (default 1.0)
"fill_color"Color to fill the ellipse with (defaults to 'color' value)
"fill_opacity"Opacity of fill (defaults to 1.0)

Example:

{
    "name":"enhance",
    "params":{}
}

Example:

{
    "name":"equalize",
    "params":{}
}

Example:

{
    "name":"gamma_channel",
    "params":{
        "gamma":1.0
    }
}

PARAMS:  Required / Optional


NameDescription
"gamma"Gamma adjustent (Usually 0.8 to 2.3)

Example:

{
    "name":"gray_colorspace",
    "params":{}
}

Example:

{
  "name":"imagga_smart_crop",
  "params":{
    "resolution" : "150x150"
   }
}

Live Sample

PARAMS:  Required / Optional


NameDescription
"resolution"The height and width of the desired cropped image. (Height and width are separated by a lower case 'x')
"no_scaling"Optional setting to not autoscale image, but to crop the raw original to the target area. Defaults to false

Example:

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

PARAMS:  Required / Optional


NameDescription
"x"Starting X coordinate
"y"Starting Y coordinate
"x1"Ending X coordinate
"y1"Ending Y coordinate
"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).

Example:

{
    "name":"median_filter",
    "params":{}
}

PARAMS:  Required / Optional


NameDescription
"radius"Radius of blur (defaults to 1.0)

Example:

{
    "name":"modulate",
    "params":{}
}

PARAMS:  Required / Optional


NameDescription
"Brightness"Brightness adjustment (defaults to 1.0)
"Saturation"Brightness adjustment(defaults to 1.0)
"Hue"Hue adjustment (defaults to 1.0)

Example:

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

Live Sample

PARAMS:  Required / Optional


NameDescription
"size"Thickness of padding
"gravity"Location of padding (default "CenterGravity")
"color"Color of padding (default "#ffffff")

Example:

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

Live Sample

PARAMS:  Required / Optional


NameDescription
"width"Output width
"height"Output height
"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:

{
    "name":"photograph",
    "params":{}
}

PARAMS:  Required / Optional


NameDescription
"angle"Angle of rotation

Example:

{
    "name":"pixelate",
    "params":{}
}

Live Sample

PARAMS:  Required / Optional


NameDescription
"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:

{
    "name":"quantize",
    "params":{
        "number_colors":8
    }
}

PARAMS:  Required / Optional


NameDescription
"number_colors"Number of colors to reduce to
"color_space"The colorspace to quantize in (defaults to "RGBColorspace")
"dither"Whether or not to use dithering on the resulting image (defaults to "false")

Example:

{
    "name":"rectangle",
    "params":{
        "x":10,
        "y":10,
        "x1":50,
        "y1":50,
        "stroke_width":5,
        "color":"#ffffff",
        "opacity":1.0,
    }
}

Live Sample

PARAMS:  Required / Optional


NameDescription
"x"Starting X coordinate
"y"Starting Y coordinate
"x1"Ending X coordinate
"y1"Ending Y coordinate
"color"Color of stroke (default "#ffffff")
"stroke_width"Width of rectangle perimeter(stroke) line (default 0, no stroke)
"stroke_opacity"Opacity of stroke (default 1.0)
"fill_color"Color to fill the rectangle with (defaults to 'color' value)
"fill_opacity"Opacity of fill (defaults to 1.0)
"ch"corner height. If present, will cause rounded corners, and REQUIRES 'cw' attribute as well
"cw"corner width. If present, will cause rounded corners, and REQUIRES 'ch' attribute as well

Example:

{
    "name":"resample",
    "params":{
        "density":72.0
    }
}

PARAMS:  Required / Optional


NameDescription
"amount"The density of the outputted image. (defaults to 72.0)

Example:

{
    "name":"resize",
    "params":{
        "width":10,
        "height":10
    }
}

PARAMS:  Required / Optional


NameDescription
"width"The new width of the image
"height"The new height of the image
"scale_factor"Instead of height and width you can set a scale factor. (eg 0.5 = 50%)

Example:

{
    "name":"resize_to_fill",
    "params":{
        "width":40,
        "height":40
    }
}

Live Sample

PARAMS:  Required / Optional


NameDescription
"width"Width of desired image
"height"Height of desired image
"gravity"Location of crop (defaults to 'CenterGravity')
"only_shrink_larger"Don't upsize image (defaults to false)

Example:

{
    "name":"resize_to_fit",
    "params":{
        "width":40,
        "height":40
    }
}

PARAMS:  Required / Optional


NameDescription
"width"Width of desired image (optional if height defined)
"height"Height of desired image (optional if width defined)
"only_shrink_larger"Don't upsize image (defaults to false)

Example:

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

PARAMS:  Required / Optional


NameDescription
"amount"The number of degrees to rotate the image.

Example:

{
    "name":"scale",
    "params":{
        "width":10,
        "height":10
    }
}

PARAMS:  Required / Optional


NameDescription
"width"The new width of the image
"height"The new height of the image
"scale_factor"Instead of height and width you can set a scale factor. (eg 0.5 = 50%)

Example:

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

Live Sample

PARAMS:  Required / Optional


NameDescription
"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:

{
    "name":"sepia_tone",
    "params":{}
}

PARAMS:  Required / Optional


NameDescription
"threshold"Threshold for quantizing sepia tone

Example:

{
    "name":"sharpen",
    "params":{}
}

PARAMS:  Required / Optional


NameDescription
"sigma"Gaussian sigma of sharpen (defaults to 1.0)
"radius"Gaussian radius of shapen (defaults to 0.0)

Example:

{
    "name":"sketch",
    "params":{}
}

PARAMS:  Required / Optional


NameDescription
"sigma"Gaussian operator (defaults to 0.0)
"radius"Gaussian operator (defaults to 0.0)
"angle"Angle of sketch (defaults to 0.0)}

Example:

{
    "name":"stegano",
    "params":{ "watermark_url" : "http://www.mysite.com/watermark.png"}
}

PARAMS:  Required / Optional


NameDescription
"watermark_url"Url of watermark to embed in image (must be grayscale)
"offset"Pixel offset from beginning of image to embed hidden watermark (defaults to 0.0)

Example:

{
    "name":"tile",
    "params":{ "src":"http://https://s3.amazonaws.com/img.blitline/test_pngs/apple.png" }
}

PARAMS:  Required / Optional


NameDescription
"src"Smaller image to be tiled on top of image
"scale"Scale factor for 'src' image (in the event it needs to be scaled) (defaults to 1.0)
"width"Resize 'src' to width, requires height as well(if set, scale is ignored)
"height"Resize 'src' to height, requires width as well(if set, scale is ignored)

Example:

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

PARAMS:  Required / Optional


NameDescription
"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)}

Example:

{
    "name":"vignette",
    "params":{}
}

PARAMS:  Required / Optional


NameDescription
"color"Background color to fade to (default is '#000000')
"x"Influences the amount of background color in the horizontal dimension. (default = 10)
"y"Influences the amount of background color in the vertical dimension. (default = 10)
"threshold"The threshold needed to apply the amount, specified as a fraction between 0 and 1.0 (defaults to 0.05)
"sigma"Gaussian operator (defaults to 10.0)
"radius"Gaussian operator (defaults to 0.0)

Example:

{
    "name":"watermark",
    "params":{
        "text":"Image processing by Blitline"
    }
}

Live Sample

PARAMS:  Required / Optional


NameDescription
"text"Text to add to image
"gravity"Relative positioning of text (default is 'CenterGravity')
"point_size"Point size of text. (default = 94)
"font_family"Font family of text. (default = 'Helvetica')
"opacity"The opacity of the text on the image (defaults to 0.45)



Param Options

Some functions require 'constant' values, such as 'gravity'. These are lists of the possible constant values to use.

options for placement on some functions

"gravity" : "EastGravity"
"gravity" : "WestGravity"
"gravity" : "NorthGravity"
"gravity" : "SouthGravity"
"gravity" : "NorthWestGravity"
"gravity" : "NorthEastGravity"
"gravity" : "SouthWestGravity"
"gravity" : "SouthEastGravity"
"gravity" : "CenterGravity"

options for saving interlance option

"type" : "UndefinedInterlace"
"type" : "NoInterlace"
"type" : "LineInterlace"
"type" : "PlaneInterlace"
"type" : "PartitionInterlace"

options for compositing

"composite_op" : "UndefinedCompositeOp" (No composite operator has been specified.)
"composite_op" : "AddCompositeOp" (The result of composite image + image, with overflow wrapping around (mod 256))
"composite_op" : "AtopCompositeOp" (The result is the same shape as image, with composite image obscuring image where the image shapes overlap. Note that this differs from OverCompositeOp because the portion of composite image outside of image’s shape does not appear in the result.
"composite_op" : "BumpmapCompositeOp" (The result image shaded by composite image.)
"composite_op" : "ColorBurnCompositeOp" (Darkens the destination color to reflect the source color. Painting with white produces no change.)
"composite_op" : "ColorDodgeCompositeOp" (Brightens the destination color to reflect the source color. Painting with black produces no change.)
"composite_op" : "ColorizeCompositeOp" (Each pixel in the result image is the combination of the brightness of the target image and the saturation and hue of the composite image. This is the opposite of LuminizeCompositeOp.)
"composite_op" : "CopyCompositeOp" (Replace the target image with the composite image.)
"composite_op" : "CopyBlackCompositeOp" (Copy the black channel from the composite image to the target image.)
"composite_op" : "CopyBlueCompositeOp" (Copy the blue channel from the composite image to the target image.)
"composite_op" : "CopyCyanCompositeOp" (Copy the cyan channel from the composite image to the target image.)
"composite_op" : "CopyGreenCompositeOp" (Copy the green channel from the composite image to the target image.)
"composite_op" : "CopyMagentaCompositeOp" (Copy the magenta channel from the composite image to the target image.)
"composite_op" : "CopyOpacityCompositeOp" (If the composite image’s matte attribute is true, copy the opacity channel from the composite image to the target image. Otherwise, set the target image pixel’s opacity to the intensity of the corresponding pixel in the composite image.)
"composite_op" : "CopyRedCompositeOp" (Copy the red channel from the composite image to the target image.)
"composite_op" : "CopyYellowCompositeOp" (Copy the yellow channel from the composite image to the target image.)
"composite_op" : "DarkenCompositeOp" (Replace target image pixels with darker pixels from the composite image.)
"composite_op" : "DifferenceCompositeOp" (The result of abs(composite image - image). This is useful for comparing two very similar images.)
"composite_op" : "DisplaceCompositeOp" (Displace target image pixels as defined by a displacement map. The operator used by the displace method.)
"composite_op" : "DissolveCompositeOp" (The operator used in the dissolve method.)
"composite_op" : "DstAtopCompositeOp" (The part of the destination lying inside of the source is composited over the source and replaces the destination.)
"composite_op" : "DstInCompositeOp" (The part of the destination lying inside of the source replaces the destination.)
"composite_op" : "DstOutCompositeOp" (The part of the destination lying outside of the source replaces the destination.)
"composite_op" : "DstOverCompositeOp" (The destination is composited over the source and the result replaces the destination.)
"composite_op" : "ExclusionCompositeOp" (Produces an effect similar to that of ’difference’, but appears as lower contrast. Painting with white inverts the destination color. Painting with black produces no change.)
"composite_op" : "HardLightCompositeOp" (Multiplies or screens the colors, dependent on the source color value. If the source color is lighter than 0.5, the destination is lightened as if it were screened. If the source color is darker than 0.5, the destination is darkened, as if it were multiplied. The degree of lightening or darkening is proportional to the difference between the source color and 0.5. If it is equal to 0.5 the destination is unchanged. Painting with pure black or white produces black or white.)
"composite_op" : "HueCompositeOp" (Each pixel in the result image is the combination of the hue of the target image and the saturation and brightness of the composite image.)
"composite_op" : "InCompositeOp" (The result is simply composite image cut by the shape of image. None of the image data of image is included in the result.)
"composite_op" : "LightenCompositeOp" (Replace target image pixels with lighter pixels from the composite image.)
"composite_op" : "LinearBurnCompositeOp" (Same as LinearDodgeCompositeOp, but also subtract one from the result. Sort of a additive ’Screen’ of the images.)
"composite_op" : "LinearDodgeCompositeOp" (This is equivelent to PlusCompositeOp in that the color channels are simply added, however it does not "plus" the alpha channel, but uses the normal OverCompositeOp alpha blending, which transparencies are involved. Produces a sort of additive multiply-like result.)
"composite_op" : "LinearLightCompositeOp" (Increase contrast slightly with an impact on the foreground’s tonal values.)
"composite_op" : "LuminizeCompositeOp" (Each pixel in the result image is the combination of the brightness of the composite image and the saturation and hue of the target image. This is the opposite of ColorizeCompositeOp.)
"composite_op" : "MinusCompositeOp" (The result of composite image - image, with overflow cropped to zero. The matte chanel is ignored (set to 255, full coverage).)
"composite_op" : "MultiplyCompositeOp" (Multiplies the color of each target image pixel by the color of the corresponding composite image pixel. The result color is always darker.)
"composite_op" : "NoCompositeOp" (No composite operator has been specified.)
"composite_op" : "OutCompositeOp" (The resulting image is composite image with the shape of image cut out.)
"composite_op" : "OverCompositeOp" (The result is the union of the the two image shapes with composite image obscuring image in the region of overlap. The matte channel of the composite image is respected, so that if the composite pixel is part or all transparent, the corresponding image pixel will show through.)
"composite_op" : "OverlayCompositeOp" (Multiplies or screens the colors, dependent on the destination color. Source colors overlay the destination whilst preserving its highlights and shadows. The destination color is not replaced, but is mixed with the source color to reflect the lightness or darkness of the destination.)
"composite_op" : "PinLightCompositeOp" (Similar to HardLightCompositeOp, but using sharp linear shadings, to similate the effects of a strong ’pinhole’ light source.)
"composite_op" : "PlusCompositeOp" (The result is just the sum of the image data. Output values are cropped to 255 (no overflow). This operation is independent of the matte channels.)
"composite_op" : "ReplaceCompositeOp" (The resulting image is image replaced with composite image. Here the matte information is ignored.)
"composite_op" : "SaturateCompositeOp" (Each pixel in the result image is the combination of the saturation of the target image and the hue and brightness of the composite image.)
"composite_op" : "ScreenCompositeOp" (Multiplies the inverse of each image’s color information.)
"composite_op" : "SoftLightCompositeOp" (Darkens or lightens the colors, dependent on the source color value. If the source color is lighter than 0.5, the destination is lightened. If the source color is darker than 0.5, the destination is darkened, as if it were burned in. The degree of darkening or lightening is proportional to the difference between the source color and 0.5. If it is equal to 0.5, the destination is unchanged. Painting with pure black or white produces a distinctly darker or lighter area, but does not result in pure black or white.)
"composite_op" : "SrcAtopCompositeOp" (The part of the source lying inside of the destination is composited onto the destination.)
"composite_op" : "SrcCompositeOp" (The source is copied to the destination. The destination is not used as input.)
"composite_op" : "SrcInCompositeOp" (The part of the source lying inside of the destination replaces the destination.)
"composite_op" : "SrcOutCompositeOp" (The part of the source lying outside of the destination replaces the destination.)
"composite_op" : "SrcOverCompositeOp" (The source is composited over the destination.)
"composite_op" : "SubtractCompositeOp" (The result of composite image - image, with underflow wrapping around (mod 256). The add and subtract operators can be used to perform reversable transformations.)
"composite_op" : "XorCompositeOp" (The result is the image data from both composite image and image that is outside the overlap region. The overlap region will be blank.)