Stop treating an already-transparent background as black, and remove the region not the colour

FixVectorService
Shipped
August 28, 2026 at 3:33 AM UTC
Author
Kamo
Commit
721fa21

Two reported faults with one root cause: colour-based removal overwrote the alpha channel outright and never read the incoming one. An HTML canvas stores premultiplied alpha, so the converter's crop step hands us every already-transparent pixel as RGB (0, 0, 0). Auto-detect sampled those corners and concluded the background was black — then deleted every dark part of the design. Measured on a transparent-background dark logo, the cut-out came back 0.1% opaque: the logo was gone. The removal was also global, so a colour that appears both behind the design and inside it was deleted in both places. A black dot inside a logo went from 2.1% of the opaque pixels to none. - The source's own transparency now wins. Corner sampling ignores transparent pixels, and a file that arrives already cut out is left alone rather than re-cut. Same rule applied to the rembg path, which cannot see alpha either. - Only the background REGION is removed: the colour match selects candidates, and what is erased is the part of that match connected to the image border. A logo that bleeds to all four edges has no border-connected background, so that case falls back to the plain colour match rather than silently doing nothing. - Edge extension before preprocessing. The upscale and the bilateral filter both blend without regard for alpha, so whatever RGB sat under a transparent pixel was pulled into the logo's edge — black, on a canvas crop. Growing the visible colours outward first kills the dark fringe. Alpha is untouched; nothing new becomes visible. Adds a `set-mask` frame so the member can correct the cut-out by hand in the new touch-up editor. It carries the alpha channel alone as an 8-bit grayscale PNG — a few hundred bytes against megabytes for the full RGBA — and the server rebuilds the image from the crop it already has cached. Verified against the running pod: the dark logo goes 0.1% -> 38.7% opaque, the enclosed dot survives, an ordinary opaque source still has its background 100% removed with a same-colour enclosed hole 100% kept, and a set-mask round trip is honoured exactly on a 692-byte frame.

All changes

Like what you see shipping?

Every one of these updates lands in your workspace automatically. Start free and watch it grow week after week.

Start Free ForeverView Pricing