# JavaScript image processing libraries

JavaScript image processing libraries decode image files, change their pixels, and encode the results in a new format or size. A processing pipeline reads an image, applies steps such as resizing, cropping, or color reduction, and writes the output. These libraries generate the thumbnails, product photos, and optimized web images that apps serve from upload pipelines and build steps.

## Popularity

| Library | Monthly downloads | Stars | Last release | License |
| --- | --- | --- | --- | --- |
| [sharp](#sharp) | 630.3M | 32.9K | Sep 2026 | Apache-2.0 |
| [@napi-rs/canvas](#napi-rs-canvas) | 197.5M | 2.4K | Nov 2026 | MIT |
| [node-canvas](#node-canvas) | 43.8M | 10.7K | Mar 2026 | MIT |
| [Image Q](#image-q) | 17.3M | 168 | Jan 2022 | MIT |
| [jimp](#jimp) | 16.7M | 14.7K | Apr 2026 | MIT |
| [Pica](#pica) | 6.4M | 4.2K | Aug 2026 | MIT |
| [imagemin](#imagemin) | 4.1M | 5.7K | Mar 2025 | MIT |
| [skia-canvas](#skia-canvas) | 1.1M | 2.6K | Nov 2026 | MIT |

Downloads: npm, last thirty days. Stars and releases: GitHub. Amber: no release in over a year.

[sharp](#sharp) has the most monthly downloads in this comparison, at 630.3M.

## Capabilities

| Library | Resize images | Canvas renderer |
| --- | --- | --- |
| [sharp](#sharp) | Yes | No |
| [@napi-rs/canvas](#napi-rs-canvas) | Yes | Yes |
| [node-canvas](#node-canvas) | Yes | Yes |
| [Image Q](#image-q) | No | No |
| [jimp](#jimp) | Yes | No |
| [Pica](#pica) | Yes | No |
| [imagemin](#imagemin) | No | No |
| [skia-canvas](#skia-canvas) | Yes | Yes |

## Libraries

### sharp

[GitHub](https://github.com/lovell/sharp) · [npm](https://www.npmjs.com/package/sharp) · [Docs](https://sharp.pixelplumbing.com)

Transforms images through a streaming image-processing pipeline.

- Downloads / mo: 630.3M
- Stars: 32.9K
- Last release: 0.35.5
- License: Apache-2.0
- Capabilities: [From the sharp docs](https://sharp.pixelplumbing.com)

**Strengths**

- **Converts common web image formats.** Read common image formats and produce JPEG, PNG, WebP, GIF, or AVIF.
- **Works with streams and buffers.** Process image data from streams, buffers, or file paths.

**Watch out for**

- **Repeated resizing replaces earlier settings.** Use separate pipelines when the same input needs multiple resize stages.

```sh
npm install sharp
```

**Quickstart**

```javascript
import sharp from 'sharp';
await sharp('input.jpg').resize({width: 320}).toFile('output.webp');

```

From [README.md](https://sharp.pixelplumbing.com/api-resize/) · [Find projects using sharp →](https://dashboard.exa.ai/playground/search?q=JavaScript%20projects%20that%20use%20sharp&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

### @napi-rs/canvas

[GitHub](https://github.com/Brooooooklyn/canvas) · [npm](https://www.npmjs.com/package/@napi-rs/canvas) · [Docs](https://github.com/Brooooooklyn/canvas#readme)

Draws with the Canvas 2D API in Node.js through a Skia binding with no system dependencies.

- Downloads / mo: 197.5M
- Stars: 2.4K
- Last release: 1.1.1
- License: MIT
- Capabilities: [From the @napi-rs/canvas docs](https://github.com/Brooooooklyn/canvas#readme)

**Strengths**

- **No system libraries to install.** Prebuilt Skia binaries install without Cairo or other system packages.

**Watch out for**

- **Needs a recent glibc on Linux.** Older Linux systems fail when their glibc predates the version that Skia requires.

```sh
npm install @napi-rs/canvas
```

**jina-ai/reader** (12.3K stars)

[jina-ai/reader](https://github.com/jina-ai/reader) 

```javascript
fitImageToSquareBox(image: canvas.Image | canvas.Canvas, size: number = 1024) {
        // this.logger.debug(`Fitting image(${ image.width }x${ image.height }) to ${ size } box`);
        // const t0 = Date.now();
        if (image.width <= size && image.height <= size) {
            if (image instanceof this.canvas.Canvas) {
                return image;
            }
            const canvasInstance = this.canvas.createCanvas(image.width, image.height);
            const ctx = canvasInstance.getContext('2d');
            ctx.drawImage(image, 0, 0, image.width, image.height, 0, 0, canvasInstance.width, canvasInstance.height);
            // this.logger.debug(`No need to resize, copied to canvas in ${ Date.now() - t0 } ms`);

            return canvasInstance;
        }

        const aspectRatio = image.width / image.height;

        const resizedWidth = Math.round(aspectRatio > 1 ? size : size * aspectRatio);
        const resizedHeight = Math.round(aspectRatio > 1 ? size / aspectRatio : size);

        const canvasInstance = this.canvas.createCanvas(resizedWidth, resizedHeight);
        const ctx = canvasInstance.getContext('2d');
        ctx.drawImage(image, 0, 0, image.width, image.height, 0, 0, resizedWidth, resizedHeight);
        // this.logger.debug(`Resized to ${ resizedWidth }x${ resizedHeight } in ${ Date.now() - t0 } ms`);

        return canvasInstance;
    }
```

[src/services/canvas.ts](https://github.com/jina-ai/reader/blob/1574bfd380d249c86c82db4dace0d9c8fe17e2b1/src/services/canvas.ts) · [More projects using @napi-rs/canvas →](https://dashboard.exa.ai/playground/search?q=%40napi-rs/canvas%20GitHub%20projects)

**Quickstart**

```javascript
import {writeFile} from 'node:fs/promises';
import {createCanvas} from '@napi-rs/canvas';
const canvas = createCanvas(100, 100);
canvas.getContext('2d').fillRect(10, 10, 50, 50);
await writeFile('output.png', await canvas.encode('png'));

```

From [README.md](https://github.com/Brooooooklyn/canvas)

### node-canvas

[GitHub](https://github.com/Automattic/node-canvas) · [npm](https://www.npmjs.com/package/canvas)

Implements the Canvas drawing API for server-side Node.js graphics.

- Downloads / mo: 43.8M
- Stars: 10.7K
- Last release: 3.2.3
- License: MIT
- Capabilities: [From the node-canvas docs](https://github.com/Automattic/node-canvas)

**Strengths**

- **Uses the familiar Canvas API.** Draw through a Canvas 2D context on the server.
- **Supports registered font files.** Register a font file before drawing text with that font.

**Watch out for**

- **Unsupported platforms require native builds.** Install Cairo and Pango when prebuilt binaries are unavailable.
- **Optional codecs affect image support.** GIF, SVG, and JPEG support depends on the corresponding native libraries.

```sh
npm install canvas
```

**SeanSobey/ChartjsNodeCanvas** (258 stars)

[SeanSobey/ChartjsNodeCanvas](https://github.com/SeanSobey/ChartjsNodeCanvas) 

```javascript
private renderChart(configuration: ChartConfiguration): ChartJS {

		const canvas = this._createCanvas(this._width, this._height, this._type);
		(canvas as any).style = (canvas as any).style || {};
		configuration.options = configuration.options || {};
		configuration.options.responsive = false;
		// Disable animation (otherwise charts will throw exceptions)
		configuration.options.animation = false;
		const context = canvas.getContext('2d');
		(global as any).Image = this._image; // Some plugins use this API
		const chart = new this._chartJs((context as any), configuration);
		delete (global as any).Image;
		return chart;
	}
```

[src/chartJSNodeCanvas.ts](https://github.com/SeanSobey/ChartjsNodeCanvas/blob/b30cce4104855f2709acf698219397ec9cb3ac2a/src/chartJSNodeCanvas.ts#L126-L139) · [More projects using node-canvas →](https://dashboard.exa.ai/playground/search?q=JavaScript%20projects%20that%20use%20canvas&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```javascript
const {writeFileSync} = require('node:fs');
const {createCanvas} = require('canvas');
const canvas = createCanvas(100, 100);
canvas.getContext('2d').fillRect(10, 10, 50, 50);
writeFileSync('output.png', canvas.toBuffer('image/png'));

```

From [Readme.md](https://github.com/Automattic/node-canvas)

### Image Q

[GitHub](https://github.com/ibezkrovnyi/image-quantization) · [npm](https://www.npmjs.com/package/image-q) · [Docs](https://github.com/ibezkrovnyi/image-quantization/tree/main/packages/image-q)

Reduces an image's colors to a smaller palette, with alpha support and several quantization algorithms.

- Downloads / mo: 17.3M
- Stars: 168
- Last release: 4.0.0
- License: MIT
- Capabilities: [From the Image Q docs](https://github.com/ibezkrovnyi/image-quantization/tree/main/packages/image-q)

**Strengths**

- **Choice of color distance formula.** Options select the formula that measures how far apart two colors are.

**Watch out for**

- **Works on pixel containers.** Images pass in and out as point containers rather than image files.

```sh
npm install image-q
```

**jimp-dev/jimp** (14.7K stars)

[jimp-dev/jimp](https://github.com/jimp-dev/jimp) 

```javascript
quantize<I extends JimpClass>(image: I, options: QuantizeOptions) {
    const {
      colors,
      colorDistanceFormula,
      paletteQuantization,
      imageQuantization,
    } = QuantizeOptionsSchema.parse(options);

    const inPointContainer = utils.PointContainer.fromUint8Array(
      new Uint8Array(image.bitmap.data.buffer),
      image.bitmap.width,
      image.bitmap.height
    );

    const palette = buildPaletteSync([inPointContainer], {
      colors,
      colorDistanceFormula,
      paletteQuantization,
    });
    const outPointContainer = applyPaletteSync(inPointContainer, palette, {
      colorDistanceFormula,
      imageQuantization,
    });

    image.bitmap.data = Buffer.from(outPointContainer.toUint8Array());

    return image;
  }
```

[plugins/plugin-quantize/src/index.ts](https://github.com/jimp-dev/jimp/blob/e1bfa9340b6a889a5c107e6f074683ea3ca6f55d/plugins/plugin-quantize/src/index.ts#L53-L80) · [More projects using Image Q →](https://dashboard.exa.ai/playground/search?q=image-q%20GitHub%20projects)

**Quickstart**

```javascript
import {utils, buildPaletteSync} from 'image-q';
const pixels = utils.PointContainer.fromUint8Array(new Uint8Array([255, 0, 0, 255, 0, 255, 0, 255]), 2, 1);
const palette = buildPaletteSync([pixels], {colors: 2});
console.log(palette);

```

From [image-q docs](https://cdn.jsdelivr.net/npm/image-q@4.0.0/dist/types/src/basicAPI.d.ts)

### jimp

[GitHub](https://github.com/jimp-dev/jimp) · [npm](https://www.npmjs.com/package/jimp) · [Docs](https://github.com/jimp-dev/jimp#readme)

Loads and edits images in JavaScript for Node.js and browsers.

- Downloads / mo: 16.7M
- Stars: 14.7K
- Last release: 1.6.1
- License: MIT
- Capabilities: [From the jimp docs](https://github.com/jimp-dev/jimp#readme)

**Strengths**

- **Avoids native image dependencies.** Use JavaScript image codecs in Node.js or browser environments.
- **Includes bitmap-font text drawing.** Load a bitmap font and print text into an image.

**Watch out for**

- **Large images increase memory use.** JavaScript codecs allocate substantial memory and prioritize portability over performance.
- **Version upgrades change method arguments.** Migrate positional image operations to v1 options objects.

```sh
npm install jimp
```

**WhiskeySockets/Baileys** (11.6K stars)

[WhiskeySockets/Baileys](https://github.com/WhiskeySockets/Baileys) 

```javascript
export const generateProfilePicture = async (
	mediaUpload: WAMediaUpload,
	dimensions?: { width: number; height: number }
) => {
	let buffer: Buffer

	const { width: w = 640, height: h = 640 } = dimensions || {}

	if (Buffer.isBuffer(mediaUpload)) {
		buffer = mediaUpload
	} else {
		// Use getStream to handle all WAMediaUpload types (Buffer, Stream, URL)
		const { stream } = await getStream(mediaUpload)
		// Convert the resulting stream to a buffer
		buffer = await toBuffer(stream)
	}

	const lib = await getImageProcessingLibrary()
	let img: Promise<Buffer>
	if ('sharp' in lib && typeof lib.sharp?.default === 'function') {
		img = lib.sharp
			.default(buffer)
			.resize(w, h)
			.jpeg({
				quality: 50
			})
			.toBuffer()
	} else if ('jimp' in lib && typeof lib.jimp?.Jimp === 'function') {
		const jimp = await (lib.jimp.Jimp as any).read(buffer)
		const min = Math.min(jimp.width, jimp.height)
		const cropped = jimp.crop({ x: 0, y: 0, w: min, h: min })

		img = cropped.resize({ w, h, mode: lib.jimp.ResizeStrategy.BILINEAR }).getBuffer('image/jpeg', { quality: 50 })
	} else {
		throw new Boom('No image processing library available')
	}

	return {
		img: await img
	}
}
```

[src/Utils/messages-media.ts](https://github.com/WhiskeySockets/Baileys/blob/81345beb67ca3fb0eb79a2c20cd4ac24da517929/src/Utils/messages-media.ts#L176-L216) · [More projects using jimp →](https://dashboard.exa.ai/playground/search?q=JavaScript%20projects%20that%20use%20jimp&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```javascript
import {Jimp} from 'jimp';
const image = await Jimp.read('input.png');
image.resize({w: 320});
await image.write('output.png');

```

From [getting-started.mdx](https://jimp-dev.github.io/jimp/api/jimp/classes/jimp/)

### Pica

[GitHub](https://github.com/nodeca/pica) · [npm](https://www.npmjs.com/package/pica)

Resizes images in the browser without pixelation.

- Downloads / mo: 6.4M
- Stars: 4.2K
- Last release: 10.0.3
- License: MIT
- Capabilities: [From the Pica docs](https://github.com/nodeca/pica)

**Strengths**

- **Shrinks images before upload.** Resizing in the browser reduces the upload size of large images.

**Watch out for**

- **Remote images need CORS headers.** Images from another domain load only with an Access-Control-Allow-Origin header.

```sh
npm install pica
```

**nodeca/image-blob-reduce** (316 stars)

[nodeca/image-blob-reduce](https://github.com/nodeca/image-blob-reduce) 

```javascript
async _transform (env: ImageBlobReduceEnv): Promise<ImageBlobReduceEnv> {
    env.out_canvas = this.pica.createCanvas(env.transform_width!, env.transform_height!)

    // Dim temporary env vars to prevent use and avoid confusion when orientation
    // changes. Take the real size from the canvas.
    env.transform_width = null
    env.transform_height = null

    const { max, ...pica_opts } = env.opts

    await this.pica.resize(env.image!, env.out_canvas, pica_opts)

    return env
  }
```

[src/index.ts](https://github.com/nodeca/image-blob-reduce/blob/772c856514eab04674fed0f2926188bb40c597bd/src/index.ts#L179-L192) · [More projects using Pica →](https://dashboard.exa.ai/playground/search?q=pica%20GitHub%20projects)

**Quickstart**

```javascript
import pica from 'pica';
const source = new Image();
source.src = 'input.jpg';
await source.decode();
const target = document.createElement('canvas');
target.width = 100;
target.height = 100;
await pica().resize(source, target);
document.body.append(target);

```

From [README.md](https://cdn.jsdelivr.net/npm/pica@10.0.3/README.md)

### imagemin

[GitHub](https://github.com/imagemin/imagemin) · [npm](https://www.npmjs.com/package/imagemin) · [Docs](https://github.com/imagemin/imagemin#readme)

Minifies image files through optimizer plugins.

- Downloads / mo: 4.1M
- Stars: 5.7K
- Last release: 9.0.1
- License: MIT
- Capabilities: [From the imagemin docs](https://github.com/imagemin/imagemin#readme)

**Strengths**

- **Optimizes in-memory image data.** The buffer method optimizes image data that is already in memory.

**Watch out for**

- **Writes files only with a destination.** Results stay in memory unless the destination option names a folder.

```sh
npm install imagemin imagemin-jpegtran
```

**vbenjs/vite-plugin-imagemin** (251 stars)

[vbenjs/vite-plugin-imagemin](https://github.com/vbenjs/vite-plugin-imagemin) 

```javascript
async function processFile(filePath: string, buffer: Buffer) {
    let content: Buffer

    try {
      content = await imagemin.buffer(buffer, {
        plugins: getImageminPlugins(options),
      })

      const size = content.byteLength,
        oldSize = buffer.byteLength

      tinyMap.set(filePath, {
        size: size / 1024,
        oldSize: oldSize / 1024,
        ratio: size / oldSize - 1,
      })

      return content
    } catch (error) {
      config.logger.error('imagemin error:' + filePath)
    }
  }
```

[packages/core/src/index.ts](https://github.com/vbenjs/vite-plugin-imagemin/blob/fcbe8aa9f0608da0c1800a51dfb108b5288f00f6/packages/core/src/index.ts#L47-L68) · [More projects using imagemin →](https://dashboard.exa.ai/playground/search?q=imagemin%20GitHub%20projects)

**Quickstart**

```javascript
import imagemin from 'imagemin';
import imageminJpegtran from 'imagemin-jpegtran';
const files = await imagemin(['images/*.jpg'], {destination: 'build/images', plugins: [imageminJpegtran()]});
console.log(files);

```

From [readme.md](https://cdn.jsdelivr.net/npm/imagemin@9.0.1/readme.md)

### skia-canvas

[GitHub](https://github.com/samizdatco/skia-canvas) · [npm](https://www.npmjs.com/package/skia-canvas) · [Docs](https://skia-canvas.org)

Renders the Canvas API in Node.js through Skia and exports vector or bitmap images.

- Downloads / mo: 1.1M
- Stars: 2.6K
- Last release: 4.0.1
- License: MIT
- Capabilities: [From the skia-canvas docs](https://skia-canvas.org)

**Strengths**

- **Vector and bitmap output.** A canvas saves as a PDF, SVG, JPEG, PNG, or WEBP file.
- **Multi-page PDF output.** Several pages on one canvas export as one PDF or as a sequence of image files.

```sh
npm install skia-canvas
```

**image-js/image-js** (1.1K stars)

[image-js/image-js](https://github.com/image-js/image-js) 

```javascript
function drawTextElement(
  image: Image,
  ctx: OffscreenCanvasRenderingContext2D | SkiaCanvasRenderingContext2D,
  text: DrawTextLabel,
  defaultFont: string,
  defaultColor: number[],
) {
  ctx.font = text.font ?? defaultFont;
  const fontColor = text.fontColor ?? defaultColor;
  validateValues(fontColor, image);
  const alpha = fontColor[3] ? fontColor[3] / 255 : 1;
  const normalizedColor = [
    fontColor[0] ?? 0,
    fontColor[1] ?? 0,
    fontColor[2] ?? 0,
    alpha,
  ];
  ctx.fillStyle = `rgba(${normalizedColor.join(',')})`;
  ctx.fillText(String(text.content), text.position.column, text.position.row);
}
```

[src/extra/draw/draw_text.ts](https://github.com/image-js/image-js/blob/21d5baabc4f967f947948329a00983f16cf8a05d/src/extra/draw/draw_text.ts) · [More projects using skia-canvas →](https://dashboard.exa.ai/playground/search?q=skia-canvas%20GitHub%20projects)

**Quickstart**

```javascript
import {Canvas} from 'skia-canvas';
const canvas = new Canvas(100, 100);
canvas.getContext('2d').fillRect(10, 10, 50, 50);
await canvas.toFile('output.png');

```

From [README.md](https://skia-canvas.org/api/canvas)

## FAQ

### What is sharp?

[sharp](#sharp) is a Node.js image processing module that converts large images in common formats to smaller JPEG, PNG, WebP, GIF, and AVIF files. It reads and writes streams, buffers, and file paths.

### What is Jimp?

[Jimp](#jimp) loads and edits images in JavaScript for Node.js and browsers without native dependencies. Its codecs run in JavaScript and use more memory on large images.

### How do I resize an image in JavaScript?

In Node.js, [sharp](#sharp) resizes an image as one step of its pipeline. In the browser, [Pica](#pica) resizes images without pixelation before they upload.

### What is node-canvas?

[node-canvas](#node-canvas) implements the Web Canvas API in Node.js on top of Cairo. Server code draws through a canvas drawing context and saves the result as an image.

### Jimp vs sharp: which should I use?

[sharp](#sharp) runs a native image pipeline in Node.js for converting and resizing large images. [Jimp](#jimp) runs entirely in JavaScript in Node.js and browsers at the cost of more memory.

### What is imagemin?

[imagemin](#imagemin) minifies image files through optimizer plugins, such as jpegtran for JPEG and pngquant for PNG. It writes files only when a destination folder is set.

## How this page was built

Data checked Nov 20, 2026.

Reproduce it with the Exa API:

```json
{
  "endpoint": "/search",
  "body": {
    "query": "JavaScript image processing libraries sharp Jimp node-canvas ImageScript resize crop composite text code examples",
    "numResults": 5
  }
}
```

Docs: https://exa.ai/docs/reference/search
