Skip to content
docs
GitHub 4.5M /week v2.2.0
API

Methods

Every image method and helper in the jimp package, grouped by what it does.

Image methods change the image in place and return it, so calls can be chained:

example.ts
image.resize({ w: 300 }).blur(2).greyscale();

Every thumbnail below was made by Jimp in your browser from the same photo. Select a method for its options, an example and a live playground. For the full generated types of every export, see the type reference.

Loading and saving

Create images from files, URLs, buffers or raw pixels, then encode them again. These are part of @jimp/core, so every Jimp has them.

Size and shape

Change the size of the canvas, cut it down, rotate, skew or bend it.

Blur and effects

Soften, sharpen, denoise, pixelate or filter the image, grow and shrink shapes with erode and dilate, or add a shadow.

Color

Adjust exposure, brightness, contrast and color, convert between color spaces, or reduce the palette.

Rendering…color()

Apply color actions such as hue, saturate, tint, mix and multiply.

toColorSpace()

Convert the pixels to sRGB or Display P3 and update the color profile.

Rendering…brightness()

Multiply every color channel. 1 leaves the image unchanged.

Rendering…contrast()

Raise or lower the contrast, from -1 to +1.

Rendering…exposure()

Brighten or darken by stops, like a camera's exposure setting.

Rendering…vibrance()

Boost muted colors more than vivid ones, from -1 to +1.

Rendering…greyscale()

Remove all color from the image.

Rendering…invert()

Invert the red, green and blue channels.

Rendering…sepia()

Apply a warm sepia tone.

Rendering…gradientMap()

Recolor an image along a gradient, like a duotone.

Rendering…posterize()

Reduce each color channel to a number of levels.

Rendering…normalize()

Stretch each channel to use the full 0 to 255 range.

Rendering…colorGrade()

Color grade with a 3D LUT from a .cube file or a Hald image.

parseCubeLut()

Read a .cube file into a 3D LUT for lut().

Rendering…threshold()

Turn pixels at or above a cut-off into one gray value.

Rendering…otsuThreshold()

Find the best threshold cut-off for an image with Otsu's method.

Rendering…quantize()

Reduce the image to a limited palette of colors.

palette()

Extract an image's main colors, most common first, with how much each covers.

dominantColor()

Find the color that covers most of an image, for backgrounds and accents.

Rendering…opacity()

Multiply the alpha channel by a factor from 0 to 1.

Rendering…fade()

Make the image more transparent by a factor from 0 to 1.

Rendering…opaque()

Make every pixel fully opaque.

Compositing

Draw one image on top of another.

Drawing

Draw antialiased lines, rectangles, ellipses, polygons and SVG paths in colors or gradients, or flood fill an area. See Drawing for paints, strokes and fill rules.

Text

Draw and measure text with bitmap fonts or TrueType, OpenType and WOFF fonts.

Pixels

Read and write individual pixels, or loop over all of them.

Comparing images

Tell whether two images look alike, with perceptual hashes or a pixel diff.

Utilities

Functions for converting and comparing colors.