Skip to content

Commit 8314d37

Browse files
matmenclaude
andcommitted
document that colorToAlpha removes the color everywhere
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ljnxm1Qjrocq1izGajLx8J
1 parent 35ab788 commit 8314d37

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
run length encoded 24/32 bit files.
2020
- **`colorToAlpha(color, options)`** (#39): makes a color transparent like GIMP's "Color to Alpha", antialiased edges
2121
become translucent instead of keeping a fringe of the removed color. Without a color, the top left pixel's is used.
22+
The color is removed everywhere in the image, not only from a connected background.
2223

2324
### Deprecated
2425

‎src/image.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1181,7 +1181,9 @@ export class Image {
11811181
/**
11821182
* Makes a color transparent, like GIMP's "Color to Alpha": the color is removed from every pixel and replaced by
11831183
* transparency, so pixels that are partly the color (e.g. antialiased edges against a background) become
1184-
* semi-transparent instead of keeping a fringe of it
1184+
* semi-transparent instead of keeping a fringe of it.
1185+
* The color is removed everywhere in the image, not only from a connected background: removing a white
1186+
* background also makes white areas inside the subject (e.g. eyes in a logo) transparent
11851187
* @param color The color to remove, by default the color of the top left pixel (e.g. a background)
11861188
* @param options See {@link ColorToAlphaOptions}
11871189
*/

0 commit comments

Comments
 (0)