This is the archived documentation for Doka Image Editor v7.

Please visit pqina.nl/pintura/docs/ to see documentation for the latest version of Pintura Image Editor.

Can the editor limit the size of the output image?

We can set the maximum size of the output image using the targetSize property on the createDefaultImageWriter method. This will limit the size of the output image to the targetSize width and height properties.

To upscale the image to fit the defined output size, set upscale to true.

openEditor({
    imageWriter: createDefaultImageWriter({
        targetSize: {
            width: 512,
            height: 512,
            upscale: true,
        },
    }),
});

By default Doka Image Editor will 'contain' the image to the supplied width and height. If the image is in a different aspect ratio it will be scaled down (or up) to fit inside the defined size.

To force the image to the defined size, and ignore the image aspect ratio, set the fit property to 'force'.

To cover the target size with the image, set the fit property to 'cover'.

openEditor({
    imageWriter: createDefaultImageWriter({
        targetSize: {
            width: 512,
            height: 512,
            fit: 'cover',
        },
    }),
});

It's currently not possible to set a limit in Kilobytes.