Experimental
Packed stencil samples or a grayscale JPEG mask. Supply exactly one byte representation.
The engine applies the mask at the image’s own resolution. A mask with more pixels than the image loses detail finer than one image pixel, so its edge can show steps when the result is larger than the image. PDF viewers apply the mask at its own resolution.
Properties#
| Property | Type | Description |
|---|---|---|
jpegBytes? |
Uint8Array |
Experimental Nonempty grayscale JPEG bytes, copied on assignment, at most 128 MiB. Omit when bitPackedBytes is present. |
bitPackedBytes? |
Uint8Array |
Experimental 1-bit stencil samples, copied on assignment, most-significant bit first, with byte-aligned rows. The size must equal Math.ceil(width / 8) * height. Do not supply jpegBytes with these samples. Decode must be absent, [0, 1], or [1, 0]. With [0, 1], zero bits paint and one bits are transparent. |
width |
number |
Experimental Mask width in pixels, an integer from 1 to 20,000. Width times height must not exceed 67,108,864 pixels. |
height |
number |
Experimental Mask height in pixels, an integer from 1 to 20,000. |
decode? |
number[] |
Experimental Two finite PDF /Decode endpoints. JPEG samples 0 and 255 map to these endpoints, clamped to [0, 1]. Omit or pass an empty array for [0, 1]. Reversed endpoints invert the mask. |
interpolate? |
boolean |
Experimental Whether to interpolate mask samples when resizing. Defaults to false for nearest-neighbor sampling. Without interpolation, JPEG stencil samples below 128 after Decode paint; samples at least 128 are transparent. |
kind? |
ImportedImageMaskKind |
Experimental Defaults to ‘Stencil’. Soft masks require jpegBytes; bitPackedBytes is stencil-only. |
matte? |
number[] |
Experimental Finite matte components in the image’s source color space. Allowed only for soft masks. The engine ignores matte correction when the mask and base image have different original dimensions. |