Resizing Images

Doka has multiple different resize options. It can automatically resize the image to a set target bounding box. It can also offer the user control over the image output size.

Automatically resizing an image

We can use the outputWidth and outputHeight properties to set an output size. To enable resizing of the output image only of the two properties is required.

Doka will resize the image to cover the created output size.

An example. If both outputWidth and outputHeight have been set to 200 and the crop made is 400 × 300, the height of the output image will be 200 and the width will be scaled down accordingly to 266.

Doka will always make sure the output image covers the defined output size. You can adjust this by setting the outputFit property.

Changing the output size algorithm

The outputFit property will determine how Doka fits the image to the defined output size.

Manually resizing an image

The 'resize' util allows the user to manually enter output size information. Enable this functionality by adding it to the utils list.

Doka.create({
    utils: [
        // other utils here,
        'resize'
    ]
})