* 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)
| 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. |
nothing calls this directly
no test coverage detected
searching dependent graphs…