@letruxux/weserv-js
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

weserv-js

A TypeScript library for interacting with the weserv.nl image processing service.

Installation

npm install @letruxux/weserv-js
bun add @letruxux/weserv-js
pnpm add @letruxux/weserv-js
yarn add @letruxux/weserv-js

Basic Usage

import { ImageWeserv } from "@letruxux/weserv-js";

const imageUrl = new ImageWeserv("https://example.com/image.jpg")
  .setWidth(300)
  .setHeight(200)
  .setFit("cover")
  .setBlur(5)
  .toString();

API Documentation

Constructor

new ImageWeserv(url: string) - Creates a new instance with the source image URL.

Transformation Methods

All methods return this for method chaining.

  • setWidth(width: number) - Sets image width
  • setHeight(height: number) - Sets image height
  • setFit(fit: FitOption) - Sets resize mode (contain|cover|fill|inside|outside)
  • setBlur(blur: number) - Sets blur intensity (0-100)
  • setQuality(q: number) - Sets output quality (1-100)
  • setOutputFormat(format: OutputFormat) - Sets output format (jpg|png|gif|tiff|webp|json)

See src/defs.ts for all available options.

Package Sidebar

Install

npm i @letruxux/weserv-js

Weekly Downloads

3

Version

0.0.2

License

MIT

Unpacked Size

15.1 kB

Total Files

10

Last publish

Collaborators

  • letruxux