Convert any file to GIF


API for converting any file to GIF.

Here are all available conversion options you can use in the "options" section of conversions (see the example JSON below the table).

Here are all available conversion options you can use in the "options" section of conversions (see the example JSON on the right).

Option Name Description
allow_multiple_outputs
Type: boolean
Default: False
If the conversion produces more than one output file, by default all of them are compressed in just one file. Set this option to true if you want a download link for each file.
allow_multiple_outputs_threshold
Type: integer
Minimum: 2
Maximum: 400
Sets the threshold for the number of output files during conversion. This option is considered only when `allow_multiple_outputs` is set to true. If the generated output files exceed this threshold, they are compressed into one file. Conversely, if the threshold is not met, each output file remains uncompressed.
alpha_channel
Type: string
Pattern: ^(auto_create|(#[a-f0-9]{6}))$
Example: #ffffff
Make the background of an image transparent by adding an alpha channel. 'auto_create' will try to detect the background automatically. Specifying a color in the format #rrggbb will set this color to be transparent.
antialias
Type: boolean
aspect_ratio
Type: string
Pattern: ^\d{1,6}:\d{1,6}$
Specify the aspect ratio of the image e.g. 16:9. If used, the options width and height are ignored.
black_white_threshold
Type: integer
Minimum: False
Maximum: 255
Sets the black/white threshold. If set to zero, a calculated average threshold is used
color
Type: string
Enum: 1900 1980 colored gray monochrome negate sepia
Default: colored
Color to apply the image
colorize_model_name
Type: string
Enum: generic nature_people
Use Artificial Intelligence to colorize old black and white pictures with a specific training model
colorize_render_factor
Type: int
Minimum: 7
Maximum: 40
Use Artificial Intelligence to colorize old black and white pictures with a specific render factor
compress
Type: string
Enum: none low medium high best
If set, this option tries to compress your file even more with no perceivable loss of quality
crop_bottom
Type: integer
Minimum: False
Maximum: 199999
Crop from the bottom. Use either the cropping from crop_top/bottom/left/right or crop_origin_x/y and crop_width/height.
crop_height
Type: integer
Minimum: True
Maximum: 200000
Specifies the height in pixels of the crop area. Use either the cropping from crop_top/bottom/left/right or crop_origin_x/y and crop_width/height.
crop_left
Type: integer
Minimum: False
Maximum: 199999
Crop from the left side. Use either the cropping from crop_top/bottom/left/right or crop_origin_x/y and crop_width/height.
crop_origin_x
Type: integer
Minimum: False
Maximum: 199999
Specifies the X origin coordinate in pixels of the crop area starting from the upmost left corner of the image. Use either the cropping from crop_top/bottom/left/right or crop_origin_x/y and crop_width/height.
crop_origin_y
Type: integer
Minimum: False
Maximum: 199999
Specifies the Y origin coordinate in pixels of the crop area starting from the upmost left corner of the image. Use either the cropping from crop_top/bottom/left/right or crop_origin_x/y and crop_width/height.
crop_right
Type: integer
Minimum: False
Maximum: 199999
Crop from the right side. Use either the cropping from crop_top/bottom/left/right or crop_origin_x/y and crop_width/height.
crop_top
Type: integer
Minimum: False
Maximum: 199999
Crop from the top. Use either the cropping from crop_top/bottom/left/right or crop_origin_x/y and crop_width/height.
crop_width
Type: integer
Minimum: True
Maximum: 200000
Specifies the width in pixels of the crop area. Use either the cropping from crop_top/bottom/left/right or crop_origin_x/y and crop_width/height.
deskew
Type: boolean
despeckle
Type: boolean
do_not_flatten
Type: boolean
Do not flatten the image
download_password
Type: string
Pattern: ^[ -~]{0,1000}$
Example: secret_password
A password to protect the download. To download the file send the password in the x-api2convert-download-password header or set a cookie named x-api2convert-download-password (the legacy x-oc-download-password header and cookie are still accepted). The value contains a comma separated list of passwords.
dpi
Type: integer
Minimum: 10
Maximum: 1200
Horizontal and vertical density of the image (referred as DPI)
enhance
Type: boolean
equalize
Type: boolean
framerate
Type: integer
Minimum: 6
Maximum: 30
Specifies the video frames per second
height
Type: number
Minimum: True
Maximum: 200000
Sets the height of the image in pixels or percentage depending on the resize_unit value
input_colorspace
Type: string
Enum: sRGB
Sets the input image's colorspace
interlace
Type: string
Enum: line none plane
Sets the type of interlacing scheme
iterations
Type: integer
Minimum: True
Maximum: 256
This option specifies the number of times the animation will repeat before coming to a stop.
mirror
Type: string
Enum: none horizontal vertical
Mirror/flip your image horizontally or vertically
normalize
Type: boolean
output_filename
Type: string
Pattern: ^[\w\W]{0,255}$
Example: my_base_filename_without_extension
The desired file name of the converted file WITHOUT the file extension.
overlays
Type: array
Additionalproperties: False
Input_id: string ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$ 1 Define the input_id of the file you want to specify as an overlay. Valid files are images
Position_x: integer -100000 100000 The position of the overlay on the x-axis
Position_y: integer -100000 100000 The position of the overlay on the y-axis
Origin: string Top-left: Top-right: Bottom-left: Bottom-right: Center: Specify the origin for the positioning of the overlay. Default is top-left
Width: integer 0 100000 The width of the overlay
Height: integer 0 100000 The height of the overlay
Opacity: string ^[0,1]$|^0\.\d{1,2}$ Define the opacity of the overlay where 0 is invisible and 1 is full opacity
Composite one or more image files onto the output as overlays (for example a watermark or logo). Each overlay is referenced by its input_id and can be positioned via origin/position_x/position_y, scaled via width/height and made transparent via opacity. Multiple overlays are applied in the given array order.
preset
Type: string
Pattern: ^[\w\W]{1,255}$
Predefined options
resize_handling
Type: string
Enum: stretch keep_aspect_ratio_fill_black keep_aspect_ratio_fill_white keep_aspect_ratio_fill_blurred keep_aspect_ratio_fill_transparent keep_aspect_ratio_crop
Default: stretch
Determine how the resizing of the image should be done. Either by stretching, keeping the original aspect ratio (filling the empty space if needed) or not upscaling the original image.
rotate
Type: integer
Minimum: True
Maximum: 359
Rotate image to specified degrees
sharpen
Type: boolean
width
Type: number
Minimum: True
Maximum: 200000
Sets the width of the image in pixels or percentage depending on the resize_unit value

Output Example

POST /v2/jobs HTTP/1.1
Host: https://api.api2convert.com
X-Oc-Api-Key: <your API key here>
Content-Type: application/json
{
    "input": [{
        "type": "remote",
        "source": "https://example-files.online-convert.com/raster%20image/png/example_small.png"
    }],
    "conversion": [{
        "category": "image",
        "target": "gif",
        "options": {
            <conversion options here>
        }
    }]
}