Skip to main content

Creating TIFF Documents | Web Document Scanner

The Scanbot Web SDK offers functionality for binary-colored TIFF generation, which allows you to store your scans with minimal file size. Create the appropriate generator as follows:

interface TiffGenerationOptions {
dpi?: number;

const options: TiffGenerationOptions = { dpi: 123 };
const generator = await scanbotSDK.beginTiff(options);


  • DPI value defaults to 72.

Adding pages

In order to allow for memory optimization, you can load an image from storage one at a time and add it to the generator. The image you add must already be binarized, i.e. contain only black and white pixels. You can pass the image data in one of two ways:

const imageArrayBuffer = await (await fetch("image.png")).arrayBuffer();

// If our image is already binarized, we can add it directly:
await generator.addPage(imageArrayBuffer);

// Otherwise, we can binarize it first:
const imageProcessor = await sdk.createImageProcessor(imageArrayBuffer);
await imageProcessor.applyFilter(new ScanbotSDK.imageFilters.ScanbotBinarizationFilter());
await generator.addPage(imageProcessor);
await imageProcessor.release();

When all images have been added, complete the transaction and receive the resulting byte array:

const bytes = await generator.complete();

As an example, you can force the tiff download of the pages in the browser via:

static saveBytes(data, name) {
const extension = name.split(".")[1];
const a = document.createElement("a");
document.body.appendChild(a); = "display: none";
const blob = new Blob([data], {type: `application/${extension}`});
const url = window.URL.createObjectURL(blob);
a.href = url; = name;;

And then call it as such:

saveBytes(bytes, "generated.tiff");

Want to scan longer than one minute?

Generate a free trial license to test the Scanbot SDK thoroughly.

Get your free Trial License

What do you think of this documentation?

On this page

Scroll to top