image_apply_contrast: Apply contrast adjustment to an image

View source: R/image_export.R

image_apply_contrastR Documentation

Apply contrast adjustment to an image

Description

Applies a contrast stretch (S-curve) to the RGB channels of a rendered image. Formula: (value - 0.5) * contrast + 0.5, clamped to [0, 1]. The default 1.0 means no change. Values > 1.0 produce darker darks and lighter highlights.

Usage

image_apply_contrast(image, contrast = 1)

Arguments

image

An image list returned by render_mesh() or render_scene().

contrast

Contrast multiplier. Default 1.0 (no change). Typical values: 1.1–1.2 for subtle S-curve, 1.5 for strong.

Value

A new image list with contrast-adjusted pixel data.

Examples

cube <- generate_cuboid(c(0, 0, 0), c(1, 1, 1))
img <- render_mesh(cube$vertices, cube$triangles)
img <- image_apply_contrast(img, contrast = 1.1)



scimesh documentation built on Aug. 9, 2026, 9:07 a.m.