Redact plugin
The redact plugin helps users redact sensitive information in images.
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, or censored information would still arrive on our server.
We can use the preprocessImageSource
and preprocessImageState
hooks to achieve this.
openDefaultEditor({
src: './my-image.jpeg',
// our custom writer logic
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;
},
},
});