v8.41.3

Redact plugin

Use the Redact plugin to enable easy and secure censoring of information

It currently has no specific UI properties. Please make sure to set the imageScrambler property to either a custom blurring function or to the return value of createDefaultImageScrambler().

Applying redaction to the source image

By default redactions are only applied to the output image. If we're also uploading the source image we need to redact it as well, otherwise censored information would still arrive on our server.

We can use the preprocessImageSource and preprocessImageState hooks to achieve this.

<!DOCTYPE html>

<link rel="stylesheet" href="./pintura.css" />

<style>
    .pintura-editor {
        height: 600px;
    }
</style>

<div id="editor"></div>

<script type="module">
    import {
        appendDefaultEditor,
        processDefaultImage,
        processImage,
    } from './pintura.js';

    const editor = appendDefaultEditor('#editor', {
        src: 'image.jpeg',
        imageWriter: {
            // apply redaction to source image
            preprocessImageSource: async (src, options, onprogress, state) => {
                const { dest } = await processDefaultImage(src, {
                    imageRedaction: [...state.redaction],
                });
                return dest;
            },

            // remove redaction from state
            preprocessImageState: (imageState) => {
                imageState.redaction = [];
                return imageState;
            },
        },
    });
</script>

Redact plugin exports

The core editor module exports the following Redact plugin objects.

Export Description
plugin_redact The redact util view.
plugin_redact_locale_en_gb The redact util locales.