Skip to contents

Reads an artwork image and extracts color pixel data for metric computation. The image is resized to 1000px width before analysis to normalize across different canvas sizes. Background colors (near-white, near-black) and transparent pixels are filtered out.

Exported for cases where you need raster data for custom analysis beyond the standard metrics. For standard benchmarking, use [calc_art_metrics()] which calls this internally.

Usage

get_image_rast(img_path)

Arguments

img_path

Character. Absolute path to image file. Supports formats readable by ImageMagick (PNG, JPG, TIFF, etc.). File must exist and be readable.

Value

List with three elements: - `colors`: data.table with columns `col` (hex color) and `N` (pixel count) - `total_px`: Integer. Total pixels in resized image (before filtering) - `colored_px`: Integer. Pixels with color (after background removal)

See also

Examples

if (FALSE) { # \dontrun{
rast_data <- get_image_rast("/path/to/artwork.png")

# Check canvas coverage
coverage_pct <- (rast_data$colored_px / rast_data$total_px) * 100

# Get unique color count
n_colors <- nrow(rast_data$colors)
} # }