* Write the image to a file * @param path the path to write the image to * @param options the options to use when writing the image * @example * ```ts * import { Jimp } from "jimp"; * * const image = Jimp.fromBuffer(Buffer.from([ * 0xff, 0x00, 0x00, 0x00, 0x
(path: PathWithExtension<Extension>, options?: Options)
| 501 | * ``` |
| 502 | */ |
| 503 | async write< |
| 504 | Extension extends string, |
| 505 | Mime extends GetMimeTypeForExtension<Extension, ExtensionToMimeType>, |
| 506 | Options extends GetOptionsForMimeType<Mime, MimeTypeToExportOptions>, |
| 507 | >(path: PathWithExtension<Extension>, options?: Options) { |
| 508 | const mimeType = mime.getType(path); |
| 509 | await writeFile( |
| 510 | path, |
| 511 | await this.getBuffer(mimeType as SupportedMimeTypes, options) |
| 512 | ); |
| 513 | } |
| 514 | |
| 515 | /** |
| 516 | * Clone the image into a new Jimp instance. |