Skip to content

Commit

Permalink
feat: stripAlpha option
Browse files Browse the repository at this point in the history
  • Loading branch information
eliassjogreen committed Feb 15, 2021
1 parent cb04116 commit 8f08742
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,13 @@ export function encode(
depth?: ValueOf<typeof BitDepth>;
compression?: ValueOf<typeof Compression>;
filter?: ValueOf<typeof FilterType>;
stripAlpha?: boolean
},
): Uint8Array {
if (options?.stripAlpha) {
image = image.filter((_, i) => (i + 1) % 4);
}

return wasmEncode(
image,
width,
Expand Down

0 comments on commit 8f08742

Please sign in to comment.