Skip to main content

Client for the Thumbor image service which allows you to build URIs in an expressive fashion using a fluent API.

This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
94%
Published
3 weeks ago (0.2.0)
interface BaseThumborUrlOptions

Base options for building a URL for the Thumbor image service. Additional options are available when resizing the image, see ThumborUrlResizedOptions.

Properties

Path to the image to be processed by Thumbor.

optional
host: string

Hostname of the Thumbor server, such as http://localhost:8888 or https://thumbor.example.com. If provided, the URL will be generated as an absolute URL. If not provided, the URL will be generated as a relative URL.

optional
key: string

Security key used to sign secure URLs. Should be kept secret and have corresponding configuration on the Thumbor server.

optional
endpoint: "image" | "metadata"

Either retrieve the image (default) or the metadata of the image.

optional
resize: { width: number | OriginalSize; height: number | OriginalSize; }

Resize the image to be a specific width and height. How it is resized can be further configured with other options.

optional
crop: { top: number; left: number; bottom: number; right: number; }

Crop the image between two points.

optional
trim: boolean | { value: TrimPixelColor; colorTolerance?: number; }

Removing surrounding space in image.

Constrain the image size inside the resized box, scaling as needed.

fit-in means that the generated image should not be auto-cropped and otherwise just fit in an imaginary box specified by ExF. If a full fit-in is specified, then the largest size is used for cropping (width instead of height, or the other way around). If adaptive fit-in is specified, it inverts requested width and height if it would get a better image definition;

true is equivalent to fit-in.

optional
smart: boolean

Use smart cropping for determining the important portion of an image.

optional
filters: readonly string[]

Add one or more filters to the image.

If you have custom filters you can supply them as a string. (e.g. "my_filter(1,2,3)").

Add Package

deno add jsr:@notwoods/thumbor-es

Import symbol

import { type BaseThumborUrlOptions } from "@notwoods/thumbor-es";

---- OR ----

Import directly with a jsr specifier

import { type BaseThumborUrlOptions } from "jsr:@notwoods/thumbor-es";

Add Package

npx jsr add @notwoods/thumbor-es

Import symbol

import { type BaseThumborUrlOptions } from "@notwoods/thumbor-es";

Add Package

yarn dlx jsr add @notwoods/thumbor-es

Import symbol

import { type BaseThumborUrlOptions } from "@notwoods/thumbor-es";

Add Package

pnpm dlx jsr add @notwoods/thumbor-es

Import symbol

import { type BaseThumborUrlOptions } from "@notwoods/thumbor-es";

Add Package

bunx jsr add @notwoods/thumbor-es

Import symbol

import { type BaseThumborUrlOptions } from "@notwoods/thumbor-es";