Pictures: Remove Background with a classical matte

The Picture Format > Remove Background button was a disabled
placeholder. picture.removeBackground now flood-fills from every edge
pixel through similar colours: each step must be close to the pixel
before it (so gradients and soft shadows follow) and to the edge colour
it started from (so it can't leak into the subject). That region turns
transparent with a one-pixel soft edge, and the picture points at a new
PNG; undo brings the original back. Tolerance 0-100 (default 20); the
ribbon offers normal, looser and tighter. Pictures whose edges are all
subject are left alone, and pictures over 16 megapixels are refused.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Nikita Rakitin
2026-10-13 23:35:25 +03:00
co-authored by Cursor
parent 457406a7a5
commit bc42b62cc4
4 changed files with 253 additions and 4 deletions
+2
View File
@@ -2,6 +2,7 @@
pub mod animation;
pub mod arrange;
pub mod background;
pub mod design;
pub mod edit;
pub mod file;
@@ -130,6 +131,7 @@ pub fn command_specs() -> &'static [CommandSpec] {
v.extend(slide::specs());
v.extend(insert::specs());
v.extend(shape::specs());
v.extend(background::specs());
v.extend(arrange::specs());
v.extend(selection::specs());
v.extend(merge::specs());