MCPcopy Index your code
hub / github.com/jimp-dev/jimp / scale

Function scale

plugins/plugin-resize/src/index.ts:142–151  ·  view source on GitHub ↗

* Uniformly scales the image by a factor. * @param f the factor to scale the image by * @param mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER) * @example * ```ts * import { Jimp } from "jimp"; * * const image = await Jimp.read("test/image.png"); * * image.scale(

(image: I, options: ScaleOptions)

Source from the content-addressed store, hash-verified

140 * ```
141 */
142 scale<I extends JimpClass>(image: I, options: ScaleOptions) {
143 const { f, mode } =
144 typeof options === "number"
145 ? ({ f: options } as ScaleComplexOptions)
146 : ScaleComplexOptionsSchema.parse(options);
147 const w = image.bitmap.width * f;
148 const h = image.bitmap.height * f;
149
150 return this.resize(image, { w, h, mode: mode });
151 },
152
153 /**
154 * Scale the image to the largest size that fits inside the rectangle that has the given width and height.

Callers

nothing calls this directly

Calls 1

resizeMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…