File size: 1,492 Bytes
ef987bb | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | # Add a configurable text watermark to uploaded images
Replace the starter `index.html` with a single offline front-end page that automatically watermarks a locally selected image and displays the result.
## Interface
- Use a file input with `data-testid="image-upload"` and a visible result canvas with `data-testid="watermark-canvas"`.
- Use `data-testid` values `wm-text` for the text control (default `Answer`), `wm-size` for font size (including 16 and 32), `wm-opacity` for opacity (0 through 1), and `wm-position` for position (including `top-left`, `center` and `bottom-right`).
- Keep each original and its corresponding result separately in memory. Expose `window.__getImageStore()` returning an independent copy of `{originals: [...], watermarked: [...]}`, two corresponding arrays of data URLs.
## Acceptance Checklist
- Uploading draws the image at its original aspect ratio and applies the default watermark without another action.
- Editing a setting updates the visible result within five seconds. Changing the text changes the lettering; a larger font enlarges it; lower opacity makes it fainter; position moves it to the selected area. At opacity zero only the original image is visible.
- Store the actual canvas result while leaving original bytes unchanged, including when editing or restoring settings. Mutating the returned store snapshot cannot change either underlying list.
- The page loads and the complete upload and editing workflow works without a network.
|