ImageJS
    Preparing search index...

    Function write

    Asynchronously write an image to the disk. This method is only implemented for Node.js.

    Path where the image should be written.

    Image to save.

    Encode options.

    • Write an image to the disk. The file format is determined automatically from the file's extension. If the extension is not supported, an error will be thrown. This method is only implemented for Node.js.

      Parameters

      • path: string | URL

        Path or file URL where the image should be written.

      • image: Image | Mask

        Image to save.

      • Optionaloptions: WriteOptions

        Write options.

      Returns Promise<void>

      A promise that resolves when the image is written.

    • Write an image to the disk as PNG. When the png format is specified, the file's extension doesn't matter. This method is only implemented for Node.js.

      Parameters

      • path: string | URL

        Path or file URL where the image should be written.

      • image: Image | Mask

        Image to save.

      • options: WriteOptionsPng

        Encode options for png images.

      Returns Promise<void>

      A promise that resolves when the image is written.

    • Write an image to the disk as JPEG. When the jpeg format is specified, the file's extension doesn't matter. This method is only implemented for Node.js.

      Parameters

      • path: string | URL

        Path or file URL where the image should be written.

      • image: Image | Mask

        Image to save.

      • options: WriteOptionsJpeg

        Encode options for jpeg images.

      Returns Promise<void>

      A promise that resolves when the image is written.

    • Write an image to the disk as BMP. When the bmp format is specified, the file's extension doesn't matter. This method is only implemented for Node.js.

      Parameters

      • path: string | URL

        Path or file URL where the image should be written.

      • image: Mask

        Image to save.

      • Optionaloptions: WriteOptionsBmp

        Encode options for bmp images.

      Returns Promise<void>

      A promise that resolves when the image is written.