Bitbybit Docs
    Preparing search index...

    Class BabylonTools

    Utilities around the rendered image: taking a screenshot of the scene at a chosen size through any camera, as an image data URL to use or as a download.

    Index

    Constructors

    screenshots

    • Renders the scene through camera, or the active camera when none is given, at the given size and gives the image back as a data URL.

      mimeType picks the format and quality from 0 to 1 the compression of lossy formats such as JPEG.

      Parameters

      • inputs: ScreenshotDto

        The camera, the size, the image type and the quality

      Returns Promise<string>

      The image as a data URL

      const image = await bitbybit.babylon.tools.createScreenshot({ camera: bitbybit.babylon.scene.getActiveCamera(), width: 1920, height: 1080, mimeType: "image/png", quality: 1 });
      
    • Renders the scene through camera, or the active camera when none is given, at the given size and downloads the image in the browser.

      Parameters

      • inputs: ScreenshotDto

        The camera, the size, the image type and the quality

      Returns Promise<string>

      The text done once the download has started

      await bitbybit.babylon.tools.createScreenshotAndDownload({ camera: bitbybit.babylon.scene.getActiveCamera(), width: 1920, height: 1080, mimeType: "image/png", quality: 1 });