Textures
Both images come from the same texture. The hue signal changes only the image on the right.
- Remote images loads a photo from a URL and processes it as a texture.
- Animated filters varies the blur radius over time and compares filters.
- Masks and layers draws an alpha mask and composites an overlay.
Size and style an image
Pass a Texture, an image path, or an HTTP(S) URL as the source. Set one dimension to size the other from the image aspect ratio. Set both dimensions with fit="cover" to fill the frame with a centered crop.
<Image src={texture} width={60%} rounded-lg border-1 border-light4 opacity={0.9}/>
Rounding clips the image itself, including textures and SVGs. Set an explicit
radius in points or use rounded-full for a pill-shaped image.
Apply GPU effects
let image = Image(
src=texture,
width=60%,
effects=[Effect.color_correction(exposure=0.3, saturation=0.8), Effect.posterize(levels=12)],
)
image
Ebi applies effects in list order after rendering the element. The same
effects work on a Box with a Material. They run on the
GPU in the editor and in the browser.
Apply pixel effects to the whole 3D scene to preserve depth ordering.
Effect.color_correction uses Shrimply's color adjustment. Exposure is in
stops, hue accepts angles, and gamma, saturation, and value default to 1.
Other effects include invert, posterize, duotone, threshold, and
channel_mixer.
Create pixels
read<Texture>(path: String): Texture
Texture(size: List<Number, 2>, pixels?: List<Color>, fill?: Color): Texture
read<Texture> and Image share Ika's bitmap decoder on desktop and in the
browser. Supported formats include PNG, JPEG, AVIF, WebP, HEIF/HEIC, JPEG XL,
GIF, BMP, TIFF, ICO, Radiance HDR, OpenEXR, DDS, Netpbm (PBM, PGM, PPM and
PAM), Farbfeld, and TGA. Animated sources appear
as stills from their default or first frame. Image also accepts SVG paths
and URLs.
Remote images use the same in-memory cache as other
read downloads. Texture sizes are integer
pixels, up to 4096 per axis within host budgets. Supply pixels in row-major
order or use fill for a solid color. The default fill is transparent.
Generate procedural textures from a pure Ebi function and animate its inputs on the timeline. GPU shaders
Geometry and filters
Call these methods on a Texture:
texture.size(): List<Number, 2>
texture.pixel(at: List<Number, 2>): Color
texture.crop(min: List<Number, 2>, size: List<Number, 2>): Texture
texture.resize(size: List<Number, 2>, filter: "nearest" | "triangle" | "catmull-rom" | "gaussian" | "lanczos3" = "lanczos3"): Texture
texture.flip(axes: "x" | "y" | "xy" = "x"): Texture
texture.rotate(angle: Angle = 90deg, expand: Bool = true, filter: "nearest" | "triangle" = "triangle", fill: Color = Color("transparent")): Texture
texture.pad(size: List<Number, 2>, at?: List<Number, 2>, fill: Color = Color("transparent")): Texture
texture.tile(size: List<Number, 2>): Texture
texture.blur(radius: Number = 2): Texture
texture.sharpen(radius: Number = 2, amount: Number = 1, threshold: Number = 0): Texture
Coordinates are pixels. crop/pixel require nonnegative integers;
pad centers by default. Rotation is clockwise. Filtering handles alpha in
linear light.
Color and composition
texture.grayscale(): Texture
texture.invert(): Texture
texture.brightness(factor: Number = 1): Texture
texture.contrast(factor: Number = 1): Texture
texture.saturation(factor: Number = 1): Texture
texture.hue(angle: Angle): Texture
texture.blend(other: Texture, amount: Number = 0.5, space: "oklab" | "oklch" | "linear-rgb" | "srgb" = "oklab"): Texture
texture.composite(over: Texture, at: List<Number, 2> = [0, 0], mode: String = "normal", opacity: Number = 1): Texture
texture.mask(mask: Texture, channel: "alpha" | "luma" = "alpha"): Texture
texture.with_alpha(alpha: Number | Texture, channel: "alpha" | "luma" = "alpha"): Texture
texture.cutout(threshold: Number = 0.5): Texture
texture.draw(content: Element): Texture
Factors are nonnegative. A factor of 1 preserves the original. blend requires
equal sizes and uses the same spaces as Color.mix. composite places an
overlay at a signed pixel offset. mask multiplies alpha, with_alpha
replaces it, and cutout makes alpha binary. draw bakes a 2D snapshot
with Ebi's WebGPU renderer. Use bitmap images or Ebi shapes in place of SVGs
in a bake, and give shader textures an explicit size.
All operations return immutable values and accept signals. Export through the CLI or editor.