GET Request

https://imgtools.vercel.app

Query Directives

src

Keyword: src
Type: string

The source of the image https? or base64 (required)

Background

Keyword: background
Type: string

This instructs various directives (e.g. the rotate) to use the specified color when filling empty spots in the image.

The argument will be parsed by the color-string library so all color values known from css like rgb, rgba or named colors can be used.

NOTE: This directive does nothing on it's own, it has to be used in conjunction with another directive.
You also cannot set multiple values.

Example:

https://imgtools.vercel.app?src=https://example.com/example.jpg?background=#FFFFFFAA

Blur

Keyword: blur
Type: float| boolean

Blurs the image. When no argument is provided it performs a fast blur. When an argument between 0.3 and 1000 is provided it performs a more accurate gaussian blur.

Example:

https://imgtools.vercel.app?src=https://example.com/example.jpg?blur
https://imgtools.vercel.app?src=exmaple.jpg?blur=0.75
https://imgtools.vercel.app?src=https://example.com/example.jpg?blur=100

Fit

Keyword: fit
Type: cover| contain | fill | inside | outside

When both a width and height are provided, this directive can be used to specify the method by which the image should fit.

Example:

https://imgtools.vercel.app?src=https://example.com/example.jpg?fit=cover

Flatten

Keyword: flatten
Type: boolean

This directive will remove the alpha channel of the image, reducing filesize. Transparent pixels will be merged with the color set by the background directive.


Flip

Keyword: flip
Type: boolean

Flip the image about the vertical axis. This step is always performed after any rotation.

Example:

https://imgtools.vercel.app?src=https://example.com/example.jpg?flip
https://imgtools.vercel.app?src=exmaple.jpg?flip=true

Flop

Keyword: flop
Type: boolean

Flop the image about the horizontal axis. This step is always performed after any rotation.

Example:

https://imgtools.vercel.app?src=https://example.com/example.jpg?flop
https://imgtools.vercel.app?src=exmaple.jpg?flop=true

Format

Keyword: format
Type: heic| heif | avif | jpeg | jpg | png | tiff | webp | gif

Convert the image into the given format.

Example:

https://imgtools.vercel.app?src=https://example.com/example.jpg?format=webp

Grayscale

Keyword: grayscale
Type: boolean

Converts the image to an 8-bit grayscale image.

This directive will convert the image to the b-w colorspace, meaning the resulting image will only have one channel.

Example:

https://imgtools.vercel.app?src=https://example.com/example.jpg?grayscale
https://imgtools.vercel.app?src=exmaple.jpg?grayscale=true

Hue

Keyword: hue
Type: integer

Adjusts the images hue rotation by the given number of degrees. Commonly used together with saturation and brightness.


Saturation

Keyword: saturation
Type: float

Adjusts the images saturation with the given saturation multiplier. Commonly used together with hue and brightness.


Brightness

Keyword: brightness
Type: float

Adjusts the images brightness with the given brightness multiplier. Commonly used together with hue and saturation.


Invert

Keyword: invert
Type: boolean

Produces a 'negative' of the image.

Example:

https://imgtools.vercel.app?src=https://example.com/example.jpg?invert
https://imgtools.vercel.app?src=exmaple.jpg?invert=true

Kernel

Keyword: kernel
Type: nearest| cubic | mitchell | lanczos2 | lanczos3

Use this directive to set a different interpolation kernel when resizing the image.


Median

Keyword: median
Type: float| boolean

Applies a median filter. This is commonly used to remove noise from images.

Example:

https://imgtools.vercel.app?src=https://example.com/example.jpg?median
https://imgtools.vercel.app?src=exmaple.jpg?median=3
https://imgtools.vercel.app?src=https://example.com/example.jpg?median=50

Normalize

Keyword: normalize
Type: boolean

'Normalizes' the image by stretching its luminance to cover the full dynamic range. This Enhances the output image contrast.

Example:

https://imgtools.vercel.app?src=https://example.com/example.jpg?normalize
https://imgtools.vercel.app?src=exmaple.jpg?normalize=true

Position

Keyword: position
Type: top| right top | right | right bottom | bottom | left bottom | left | left top | north | northeast | east | southeast | south | southwest | west | northwest | center | centre | cover | entropy | attention

When both width and height are provided AND the fit is one of fit of cover or contain, this directive can be used to set the position of the image.

See sharps resize options for a detailed explanation of each.


Quality

Keyword: quality
Type: integer

All formats (except gif) allow the quality to be adjusted by setting this directive.

The argument must be a number between 0 and 100.

See sharps Output options for default quality values.

Example:

https://imgtools.vercel.app?src=https://example.com/example.jpg?format=webp&quality=80
https://imgtools.vercel.app?src=https://example.com/example.jpg?png&quality=200

Width

Keyword: width| w
Type: integer

Resizes the image to be the specified amount of pixels wide. If not given the height will be scaled accordingly.

Example:

https://imgtools.vercel.app?src=https://example.com/example.jpg?width=200
https://imgtools.vercel.app?src=https://example.com/example.jpg?w=200

Height

Keyword: height| h
Type: integer

Resizes the image to be the specified amount of pixels tall. If not given the width will be scaled accordingly.

Example:

https://imgtools.vercel.app?src=https://example.com/example.jpg?height=200
https://imgtools.vercel.app?src=https://example.com/example.jpg?h=200

Aspect

Keyword: aspect | ar
Type: string | number

Resizes the image to be the specified aspect ratio. Aspect ratio can be defined with a string in the form 16:9 or a positive number representing the width divided by height (e.g., 1.5 for a 3:2 aspect ratio) If height and width are both provided, this will be ignored. If height is provided, the width will be scaled accordingly. If width is provided, the height will be scaled accordingly. If neither height nor width are provided, the image will be cropped to the given aspect ratio.

Example:

https://imgtools.vercel.app?src=https://example.com/example.jpg?aspect=16:9
https://imgtools.vercel.app?src=https://example.com/example.jpg?aspect=16:9&height=200
https://imgtools.vercel.app?src=https://example.com/example.jpg?aspect=16:9&width=200

Rotate

Keyword: rotate
Type: integer

Rotate the image by the specified number of degrees.

NOTE: You can change the background color the empty parts are filled with by setting the background directive.

Example:

https://imgtools.vercel.app?src=https://example.com/example.jpg`rotate=90
https://imgtools.vercel.app?src=https://example.com/example.jpg`rotate=68

Tint

Keyword: tint
Type: string

Tints the image using the provided chroma while preserving the image luminance. If the image has an alpha channel it will be untouched.

Example:

https://imgtools.vercel.app?src=https://example.com/example.jpg?tint=#ffaa22
https://imgtools.vercel.app?src=https://example.com/example.jpg?tint=rgba(10,33,127)