import adjust from './transformers/adjust.js'; import backgroundAlpha from './transformers/background-alpha.js'; import background from './transformers/background.js'; import blurDetections from './transformers/blur-detections.js'; import blur from './transformers/blur.js'; import brightness from './transformers/brightness.js'; import cacheBuster from './transformers/cache-buster.js'; import contrast from './transformers/contrast.js'; import crop from './transformers/crop.js'; import disableAnimation from './transformers/disable-animation.js'; import dpi from './transformers/dpi.js'; import dpr from './transformers/dpr.js'; import drawDetections from './transformers/draw-detections.js'; import duotone from './transformers/duotone.js'; import expires from './transformers/expires.js'; import extendAspectRatio from './transformers/extend-aspect-ratio.js'; import extend from './transformers/extend.js'; import fallbackImageUrl from './transformers/fallback-image-url.js'; import fileName from './transformers/filename.js'; import formatQuality from './transformers/format-quality.js'; import format from './transformers/format.js'; import gifOptions from './transformers/gif-options.js'; import gradient from './transformers/gradient.js'; import gravity from './transformers/gravity.js'; import jpegOptions from './transformers/jpeg-options.js'; import maxBytes from './transformers/max-bytes.js'; import minHeight from './transformers/min-height.js'; import minWidth from './transformers/min-width.js'; import monochrome from './transformers/monochrome.js'; import pad from './transformers/pad.js'; import page from './transformers/page.js'; import pixelate from './transformers/pixelate.js'; import pngOptions from './transformers/png-options.js'; import preset from './transformers/preset.js'; import quality from './transformers/quality.js'; import raw from './transformers/raw.js'; import resize from './transformers/resize.js'; import resizingAlgorithm from './transformers/resizing-algorithm.js'; import rotate from './transformers/rotate.js'; import saturation from './transformers/saturation.js'; import sharpen from './transformers/sharpen.js'; import skipProcessing from './transformers/skip-processing.js'; import style from './transformers/style.js'; import trim from './transformers/trim.js'; import unsharpen from './transformers/unsharpen.js'; import videoThumbnailSecond from './transformers/video-thumbnail-second.js'; import videoThumbnailTile from './transformers/video-thumbnail-tile.js'; import watermarkShadow from './transformers/watermark-shadow.js'; import watermarkSize from './transformers/watermark-size.js'; import watermarkText from './transformers/watermark-text.js'; import watermarkUrl from './transformers/watermark-url.js'; import watermark from './transformers/watermark.js'; import zoom from './transformers/zoom.js'; import hashsum from './transformers/hashsum.js'; import videoThumbnailKeyframes from './transformers/video-thumbnail-keyframes.js'; /** * The build options */ export type BuildOptions = { /** * The path to the target image, e.g. `https://example.com/foo.png` */ path: string; /** * The base URL of the imgproxy instance, e.g. https://my-imgproxy.test */ baseUrl?: string; /** * Whether to append the path in plain. * * Defaults to false. If false, encodes the path to a base64url */ plain?: boolean; /** * Whether to append the extension (or filetype) to the end of the url. * * Defaults to false. If true adds the extension. */ addExtension?: boolean; /** * The signature to apply */ signature?: { /** * The hex-encoded key of the signature */ key: string; /** * The hex encoded salt of the signature */ salt: string; /** * The number of bytes to use for the signature before encoding to Base64 * * Defaults to 32 */ size?: number; }; }; declare class ParamBuilder { /** * The currently applied imgproxy modifiers */ readonly modifiers: Map; constructor(initialModifiers?: Map); /** * Creates a new param builder instance with a copy of the * current modifiers * * @returns A copy of this param builder */ clone(this: this): ParamBuilder; /** * Removes the specified modifier from the currently applied * modifiers * * @param modifier The modifier */ unset(this: this, modifier: Omit): this; /** * Builds the imgproxy URL * * If a path is supplied, the full URL path will be returned, * else only the stringified modifiers will be returned. * * If a base URL is supplied, the full imgproxy URL will be returned. * * @param options The build options * @returns The imgproxy URL */ build(options?: BuildOptions): string; /** * Get the extension for the file. Checks the specified format and the target image. * * See https://github.com/imgproxy/imgproxy/blob/5ac79477dfa76ed3c014a1472e31e26a2d2257a0/docs/generating_the_url.md#source-url for the imgproxy documentation * * @param path The path to the target image, e.g. `https://example.com/foo.png` * @returns An extension if found, or an empty string */ private getExtension; /** * Defines the brightness, contrast, and saturation. * * See https://github.com/imgproxy/imgproxy/blob/6f292443eafb2e39f9252175b61faa6b38105a7c/docs/generating_the_url.md#adjust-idadjust for the imgproxy documentation * * @example * ```typescript * pb().adjust({ * brightness: 100, // optional * contrast: 0.8, // optional * saturation: 0.9 // optional * }); * ``` */ adjust(this: this, ...options: Parameters): this; /** * Automatically rotates the image based on the EXIF orientation parameter. * * See https://github.com/imgproxy/imgproxy/blob/6f292443eafb2e39f9252175b61faa6b38105a7c/docs/generating_the_url.md#auto-rotate for the imgproxy documentation * * @example * ```typescript * pb().autoRotate(); * ``` */ autoRotate(this: this): this; /** * Fills the image background with the specified color. * * See https://github.com/imgproxy/imgproxy/blob/6f292443eafb2e39f9252175b61faa6b38105a7c/docs/generating_the_url.md#background for the imgproxy documentation * * @example * ```typescript * pb().background('ff0000'); * * pb().background({ * r: 255, * g: 0, * b: 0 * }); * ``` */ background(this: this, ...options: Parameters): this; /** * Adds alpha channel to background. * * See https://github.com/imgproxy/imgproxy/blob/6f292443eafb2e39f9252175b61faa6b38105a7c/docs/generating_the_url.md#background-alpha-idbackground-alpha for the imgproxy documentation * * @example * ```typescript * pb().backgroundAlpha(0.4); * ``` */ backgroundAlpha(this: this, ...options: Parameters): this; /** * Applies a gaussian blur filter to the image. * * See https://github.com/imgproxy/imgproxy/blob/6f292443eafb2e39f9252175b61faa6b38105a7c/docs/generating_the_url.md#blur for the imgproxy documentation * * @example * ```typescript * pb().blur(10); * ``` */ blur(this: this, ...options: Parameters): this; /** * Detects objects of the provided classes and blurs them. * * See https://github.com/imgproxy/imgproxy/blob/6f292443eafb2e39f9252175b61faa6b38105a7c/docs/generating_the_url.md#blur-detections-idblur-detections for the imgproxy documentation * * @example * ```typescript * pb().blurDetections({ * sigma: 10, * classNames: ['face'] * }); * ``` */ blurDetections(this: this, ...options: Parameters): this; /** * Adjusts the brightness of an image. * * See https://github.com/imgproxy/imgproxy/blob/6f292443eafb2e39f9252175b61faa6b38105a7c/docs/generating_the_url.md#brightness-idbrightness for the imgproxy documentation * * @example * ```typescript * pb().brightness(-100); * ``` */ brightness(this: this, ...options: Parameters): this; /** * Adds a cache buster to the imgproxy params. * * See https://github.com/imgproxy/imgproxy/blob/6f292443eafb2e39f9252175b61faa6b38105a7c/docs/generating_the_url.md#cache-buster for the imgproxy documentation * * @example * ```typescript * pb().cacheBuster("abcdef123"); * ``` */ cacheBuster(this: this, ...options: Parameters): this; /** * Adjust contrast of the resulting image. * * See https://github.com/imgproxy/imgproxy/blob/6f292443eafb2e39f9252175b61faa6b38105a7c/docs/generating_the_url.md#contrast-idcontrast for the imgproxy documentation * * @example * ```typescript * pb().contrast(0.3); * ``` */ contrast(this: this, ...options: Parameters): this; /** * Crops the image. * * See https://github.com/imgproxy/imgproxy/blob/6f292443eafb2e39f9252175b61faa6b38105a7c/docs/generating_the_url.md#crop for the imgproxy documentation * * @example * ```typescript * pb().crop({ * width: 100, // optional * height: 50, // optional * gravity: { // optional * type: GravityType.CENTER, // required * offset: { // optional * x: 20, // required * y: 20 // required * } * } * }) * ``` */ crop(this: this, ...options: Parameters): this; /** * Use a single frame of animated images. * * See https://github.com/imgproxy/imgproxy/blob/cfa4b596d1f31656f9116cc16f2a4ff7d15c2837/docs/generating_the_url.md#disable-animation-iddisable-animation for the imgproxy documentation * * @example * ```typescript * pb().disableAnimation(); * ``` */ disableAnimation(this: this, ...options: Parameters): this; /** * When set, imgproxy will replace the image's DPI metadata with the provided value. * * See https://github.com/imgproxy/imgproxy/blob/8629c5eca1e422908363f471513bfc887d778a85/docs/generating_the_url.md#dpi-iddpi for the imgproxy documentation * * @example * ```typescript * pb().dpi(300); * ``` */ dpi(this: this, ...options: Parameters): this; /** * Multiplies the dimensions according to the specified factor. * * See https://github.com/imgproxy/imgproxy/blob/6f292443eafb2e39f9252175b61faa6b38105a7c/docs/generating_the_url.md#dpr for the imgproxy documentation * * @example * ```typescript * pb().dpr(18); * ``` */ dpr(this: this, ...options: Parameters): this; /** * Detects objects of the provided classes and draws their * bounding boxes. * * See https://github.com/imgproxy/imgproxy/blob/6f292443eafb2e39f9252175b61faa6b38105a7c/docs/generating_the_url.md#draw-detections-iddraw-detections for the imgproxy documentation * * @example * ```typescript * pb().drawDetections({ * classNames: ["face"] * }); * ``` */ drawDetections(this: this, ...options: Parameters): this; /** * Converts the image to duotone with specified intensity and colors. * * See https://github.com/imgproxy/imgproxy-docs/blob/7d15484aea6a1fae5f1dfd1806b5551a4774658d/docs/usage/processing.mdx?plain=1#L429 for the imgproxy documentation * * @example * ```typescript * pb().duotone({ * intensity: 1.0, // required * color1: 'ff0000', // required * color2: '00ff00' // required * }); * ``` */ duotone(this: this, ...options: Parameters): this; /** * If the source image has an embedded thumbnail, imgproxy will use the * embedded thumbnail instead of the main image. * * See https://github.com/imgproxy/imgproxy/blob/6f292443eafb2e39f9252175b61faa6b38105a7c/docs/generating_the_url.md#enforce-thumbnail for the imgproxy documentation * * @example * ```typescript * pb().enforceThumbnail(); * ``` */ enforceThumbnail(this: this): this; /** * Enlarges the image if it is smaller than the given size. * * See https://github.com/imgproxy/imgproxy/blob/6f292443eafb2e39f9252175b61faa6b38105a7c/docs/generating_the_url.md#enlarge for the imgproxy documentation * * @example * ```typescript * pb().enlarge(); * ``` */ enlarge(this: this): this; /** * Returns a 404 if the expiration date is reached. * * See https://github.com/imgproxy/imgproxy/blob/6f292443eafb2e39f9252175b61faa6b38105a7c/docs/generating_the_url.md#expires for the imgproxy documentation * * @example * ```typescript * pb().expires(new Date()); * * pb().expires(1661431326); * ``` */ expires(this: this, ...options: Parameters): this; /** * Extends the image if it is smaller than the given size. * * See https://github.com/imgproxy/imgproxy/blob/6f292443eafb2e39f9252175b61faa6b38105a7c/docs/generating_the_url.md#extend for the imgproxy documentation * * @example * ```typescript * pb().extend(); * * pb().extend({ * gravity: { * type: GravityType.NORTH // required * offset: { // optional * x: 10; // required * y: 20; // required * } * } * }); * ``` */ extend(this: this, ...options: Parameters): this; /** * Extends the image to the requested aspect ratio. * * See https://github.com/imgproxy/imgproxy/blob/1a9768a2c682e88820064aa3d9a05ea234ff3cc4/docs/generating_the_url.md#extend-aspect-ratio for the imgproxy documentation * * @example * ```typescript * pb().extendAspectRatio(); * * pb().extendAspectRatio({ * gravity: { * type: GravityType.NORTH // required * offset: { // optional * x: 10; // required * y: 20; // required * } * } * }); * ``` */ extendAspectRatio(this: this, ...options: Parameters): this; /** * Sets a custom fallback image by specifying its URL. * * See https://github.com/imgproxy/imgproxy/blob/6f292443eafb2e39f9252175b61faa6b38105a7c/docs/generating_the_url.md#fallback-image-url-idfallback-image-url for the imgproxy documentation * * @example * ```typescript * pb().fallbackImageUrl('https://example.com'); * ``` */ fallbackImageUrl(this: this, ...options: Parameters): this; /** * Sets the filename for the Content-Disposition header. * * See https://github.com/imgproxy/imgproxy/blob/41b9ebe9277ef3e664e0a842fbc0e912b2640969/docs/generating_the_url.md#filename for the imgproxy documentation * * @example * ```typescript * // Not encoded * pb().fileName('filename.png'); * * // Encoded * pb().fileName('ZmlsZW5hbWUucG5n', true); * ``` */ fileName(this: this, ...options: Parameters): this; /** * Specifies the resulting image format. * * See https://github.com/imgproxy/imgproxy/blob/6f292443eafb2e39f9252175b61faa6b38105a7c/docs/generating_the_url.md#format for the imgproxy documentation * * @example * ```typescript * pb().format('png'); * ``` */ format(this: this, ...options: Parameters): this; /** * Sets the desired quality for each format. * * See https://github.com/imgproxy/imgproxy/blob/6f292443eafb2e39f9252175b61faa6b38105a7c/docs/generating_the_url.md#format-quality for the imgproxy documentation * * @example * ```typescript * pb().formatQuality({ * jpeg: 100, * png: 50, * // ... * }); * ``` */ formatQuality(this: this, ...options: Parameters): this; /** * Allows redefining GIF saving options. * * @deprecated Automatically applied since version 3.0.0 * @example * ```typescript * pb().gifOptions({ * optimizeFrames: true, // optional * optimizeTransparency: 50 // optional * }); * ``` */ gifOptions(this: this, ...options: Parameters): this; /** * Places a gradient on the processed image. * * See https://github.com/imgproxy/imgproxy/blob/cfa4b596d1f31656f9116cc16f2a4ff7d15c2837/docs/generating_the_url.md#gradient-idgradient for the imgproxy documentation * * @example * ```typescript * pb().gradient({ * opacity: 1, // required * color: 'ababab', // optional * direction: 'up', // optional * start: 0.0, // optional * stop: 0.7 // optional * }); * ``` */ gradient(this: this, ...options: Parameters): this; /** * Sets the gravity. * * See https://github.com/imgproxy/imgproxy/blob/6f292443eafb2e39f9252175b61faa6b38105a7c/docs/generating_the_url.md#gravity for the imgproxy documentation * * @example * ```typescript * pb().gravity({ * type: GravityType.NORTH // required * offset: { // optional * x: 10, // required * y: 20 // required * } * }); * ``` */ gravity(this: this, ...options: Parameters): this; /** * When `hashsum_type` is not `none`, imgproxy will calculate the hashsum of the source image * and compare it with the provided hashsum. * * See https://github.com/imgproxy/imgproxy-docs/blob/f9d7908d253ec2b31425b988a48f8c28cb271c58/docs/usage/processing.mdx#L916 for the imgproxy documentation * * @example * ```typescript * pb().hashsum({ * hashsum: 'ABCDEF', // required * type: HashsumType.NONE // optional * }); * ``` */ hashsum(this: this, ...options: Parameters): this; /** * Allows redefining JPEG saving options. * * See https://github.com/imgproxy/imgproxy/blob/6f292443eafb2e39f9252175b61faa6b38105a7c/docs/generating_the_url.md#jpeg-options-idjpeg-options for the imgproxy documentation * * @example * ```typescript * pb().jpegOptions({ * progressive: boolean, // optional * noSubsample: boolean, // optional * trellisQuant: boolean, // optional * overshootDeringing: boolean, // optional * optimizeScans: boolean, // optional * quantizationTable: 7 // optional * }); * ``` */ jpegOptions(this: this, ...options: Parameters): this; /** * Preserve the copyright info while stripping metadata. * * See https://github.com/imgproxy/imgproxy/blob/6f292443eafb2e39f9252175b61faa6b38105a7c/docs/generating_the_url.md#keep-copyright for the imgproxy documentation * * @example * ```typescript * pb().keepCopyright(); * ``` */ keepCopyright(this: this): this; /** * Limits the file size to the specified number of bytes. * * See https://github.com/imgproxy/imgproxy/blob/6f292443eafb2e39f9252175b61faa6b38105a7c/docs/generating_the_url.md#max-bytes for the imgproxy documentation * * @example * ```typescript * pb().maxBytes(10); * ``` */ maxBytes(this: this, ...options: Parameters): this; /** * Defines the minimum height of the resulting image. * * See https://github.com/imgproxy/imgproxy/blob/6f292443eafb2e39f9252175b61faa6b38105a7c/docs/generating_the_url.md#min-height for the imgproxy documentation * * @example * ```typescript * pb().minHeight(100); * ``` */ minHeight(this: this, ...options: Parameters): this; /** * Defines the minimum width of the resulting image. * * See https://github.com/imgproxy/imgproxy/blob/6f292443eafb2e39f9252175b61faa6b38105a7c/docs/generating_the_url.md#min-width for the imgproxy documentation * * @example * ```typescript * pb().minWidth(100); * ``` */ minWidth(this: this, ...options: Parameters): this; /** * Converts the image to monochrome. * * See https://github.com/imgproxy/imgproxy-docs/blob/7d15484aea6a1fae5f1dfd1806b5551a4774658d/docs/usage/processing.mdx?plain=1#L415 for the imgproxy documentation * * @example * ```typescript * pb().monochrome({ * intensity: 0.3, // required * color: 'ff0000' // optional * }); * ``` */ monochrome(this: this, ...options: Parameters): this; /** * Applies the specified padding to the image. * * See https://github.com/imgproxy/imgproxy/blob/6f292443eafb2e39f9252175b61faa6b38105a7c/docs/generating_the_url.md#padding for the imgproxy documentation * * @example * ```typescript * pb().pad({ * top: 100, // optional (Note: sets all other sides if not set explicitly) * right: 100, // optional * bottom: 10, // optional * left: 10 // optional * }); * ``` */ pad(this: this, ...options: Parameters): this; /** * When source image supports pagination (PDF, TIFF) or animation (GIF, WebP), this option allows * specifying the page to use. * * See https://github.com/imgproxy/imgproxy/blob/6f292443eafb2e39f9252175b61faa6b38105a7c/docs/generating_the_url.md#page-idpage for the imgproxy documentation * * @example * ```typescript * pb().page(10); * ``` */ page(this: this, ...options: Parameters): this; /** * Apply the pixelate filter to the resulting image. * * See https://github.com/imgproxy/imgproxy/blob/6f292443eafb2e39f9252175b61faa6b38105a7c/docs/generating_the_url.md#pixelate for the imgproxy documentation * * @example * ```typescript * pb().pixelate(5); * ``` */ pixelate(this: this, ...options: Parameters): this; /** * Allows redefining PNG saving options. * * See https://github.com/imgproxy/imgproxy/blob/6f292443eafb2e39f9252175b61faa6b38105a7c/docs/generating_the_url.md#png-options-idpng-options for the imgproxy documentation * * @example * ```typescript * pb().pngOptions({ * interlaced: true, // optional * quantize: false, // optional * quantization_colors: 10 // optional * }); * ``` */ pngOptions(this: this, ...options: Parameters): this; /** * Sets one or many presets to be used by the imgproxy. * * See https://github.com/imgproxy/imgproxy/blob/6f292443eafb2e39f9252175b61faa6b38105a7c/docs/generating_the_url.md#preset for the imgproxy documentation * * @example * ```typescript * pb().preset('mypreset'); * * pb().preset(['preset1', 'preset2']); * ``` */ preset(this: this, ...options: Parameters): this; /** * Returns a raw unprocessed and unchecked source image * * See https://github.com/imgproxy/imgproxy/blob/f95f57bb4df35c69ae2257958006ef54b1c1d8c7/docs/generating_the_url.md#raw for the imgproxy documentation * * @example * ```typescript * pb().raw(); * ``` */ raw(this: this, ...options: Parameters): this; /** * Defines the algorithm that imgproxy will use for resizing. * * See https://github.com/imgproxy/imgproxy/blob/6f292443eafb2e39f9252175b61faa6b38105a7c/docs/generating_the_url.md#resizing-algorithm-idresizing-algorithm for the imgproxy documentation * * @example * ```typescript * pb().resizingAlgorithm(ResizingAlgorithm.NEAREST)); * ``` */ resizingAlgorithm(this: this, ...options: Parameters): this; /** * Returns attachment in the Content-Disposition header. * * See https://github.com/imgproxy/imgproxy/blob/6f292443eafb2e39f9252175b61faa6b38105a7c/docs/generating_the_url.md#return-attachment for the imgproxy documentation * * @example * ```typescript * pb().returnAttachment(); * ``` */ returnAttachment(this: this): this; /** * Redefines the quality of the resulting image. * * See https://github.com/imgproxy/imgproxy/blob/6f292443eafb2e39f9252175b61faa6b38105a7c/docs/generating_the_url.md#quality for the imgproxy documentation * * @example * ```typescript * pb().quality(80); * ``` */ quality(this: this, ...options: Parameters): this; /** * Resizes the image. * * See https://github.com/imgproxy/imgproxy/blob/6f292443eafb2e39f9252175b61faa6b38105a7c/docs/generating_the_url.md#resize for the imgproxy documentation * * @example * ```typescript * pb().resize({ * type: ResizeType.AUTO, // optional * width: 100, // optional * height: 50 // optional * }); * ``` */ resize(this: this, ...options: Parameters): this; /** * Rotates the image by the specified angle. * * See https://github.com/imgproxy/imgproxy/blob/6f292443eafb2e39f9252175b61faa6b38105a7c/docs/generating_the_url.md#rotate for the imgproxy documentation * * @example * ```typescript * pb().rotate(90); * ``` */ rotate(this: this, ...options: Parameters): this; /** * Adjust saturation of the resulting image. * * See https://github.com/imgproxy/imgproxy/blob/6f292443eafb2e39f9252175b61faa6b38105a7c/docs/generating_the_url.md#saturation-idsaturation for the imgproxy documentation * * @example * ```typescript * pb().saturation(0.3); * ``` */ saturation(this: this, ...options: Parameters): this; /** * Applies a sharpen filter to the image. * * See https://github.com/imgproxy/imgproxy/blob/6f292443eafb2e39f9252175b61faa6b38105a7c/docs/generating_the_url.md#sharpen for the imgproxy documentation * * @example * ```typescript * pb().sharpen(3); * ``` */ sharpen(this: this, ...options: Parameters): this; /** * Skip the processing of the listed formats. * * See https://github.com/imgproxy/imgproxy/blob/6f292443eafb2e39f9252175b61faa6b38105a7c/docs/generating_the_url.md#skip-processing for the imgproxy documentation * * @example * ```typescript * pb().skipProcessing(['png', 'svg']); * ``` */ skipProcessing(this: this, ...options: Parameters): this; /** * Strips the color profile from the image. * * See https://github.com/imgproxy/imgproxy/blob/6f292443eafb2e39f9252175b61faa6b38105a7c/docs/generating_the_url.md#strip-color-profile for the imgproxy documentation * * @example * ```typescript * pb().stripColorProfile(); * ``` */ stripColorProfile(this: this): this; /** * Strips the metadata from the image. * * See https://github.com/imgproxy/imgproxy/blob/6f292443eafb2e39f9252175b61faa6b38105a7c/docs/generating_the_url.md#strip-metadata for the imgproxy documentation * * @example * ```typescript * pb().stripMetadata(); * ``` */ stripMetadata(this: this): this; /** * Prepend a `