Why an Overlay Is Not Redaction
Drawing a black rectangle on top of a canvas leaves the underlying pixels untouched; anyone who removes the layer or reads the file before flattening recovers the text. True redaction samples the region and writes new values into the pixel buffer, then exports the flattened result. The distinction matters most in PDFs, where a drawn box can sit above a still-selectable text layer.
A workable editor keeps an undo stack of ImageData snapshots taken before each operation. Memory grows at four bytes per pixel per step, so a 4000 by 3000 photo costs 48 MB per snapshot; cap history at a handful of steps or store only the modified rectangle. Undo must restore pixels, not remove a visual layer, or the guarantee is fiction.