artbenchmark computes image-derived metrics for artwork analysis within the Artalytics benchmark framework. It extracts color, coverage, and complexity metrics from artwork images to support portfolio-relative benchmarking across Time & Effort, Skill & Artistry, and Complexity & Detail categories.
Installation
# Install from GitHub (requires GITHUB_PAT)
pak::pkg_install("artalytics/artbenchmark")Environment Variables
artbenchmark requires no environment variables. It is a pure computation package with no database or API dependencies.
The package uses only standard R dependencies (data.table, magick, stats, stringr) and operates on local image files.
Quick Example
library(artbenchmark)
# Compute metrics from an artwork image
metrics <- calc_art_metrics(
img_path = "/path/to/artwork/main.png",
file_sz = 1500000, # bytes (from file.info)
draw_mins = 120, # minutes (from Procreate stats)
strokes = 45000 # count (from Procreate stats)
)
# Returns data.table with metric_key and value columns
print(metrics)
#> metric_key value
#> 1: canvas_coverage 87.234567
#> 2: n_unique_colors 8234.000000
#> 3: share_of_spectrum 0.000491
#> 4: ave_blend_rate 0.817234
#> 5: ave_colors_pstroke 0.183011
#> 6: q75_color_freq 1234.000000
#> ... (extended metrics)
# Add identifiers and persist to database
metrics[, `:=`(
art_uuid = "99a61148-1d3b-4340-8cf6-92ad26046b0f",
artist_uuid = "746b8207-72f5-4ab6-8d19-a91d03daec3d",
created_utc = Sys.time()
)]What artbenchmark Does
artbenchmark is a specialized computation package that:
- Extracts color palettes from artwork images with background filtering
- Computes 6 core metrics used in the benchmark framework
- Computes 8 extended metrics for future analytics
- Provides predictions for missing metrics when Procreate stats are unavailable
- Defines the metric framework with authoritative names and categories
Core Metrics Computed
| Metric | Category | Measures |
|---|---|---|
| Canvas Coverage | Time & Effort | % of canvas with color |
| Unique Colors | Skill & Artistry | Palette diversity |
| Spectrum Coverage | Skill & Artistry | RGB color space utilization |
| Blend Rate | Skill & Artistry | Color blending quality |
| Colors per Stroke | Complexity & Detail | Brushing precision |
| Color Variability | Complexity & Detail | Color frequency distribution |
Package Hierarchy
appPlatform / mod* packages (application layer)
|
artutils (data access + benchmarking)
|
artbenchmark (metric computation) ← This package
artbenchmark has no dependencies on other Artalytics packages. It is a pure computation layer used by artutils::update_artist_benchmarks() for portfolio-relative percentile calculations.
Documentation
- Get Started - Complete workflow guide
- Quickstart - 5-minute tutorial
- Advanced Workflow - Batch processing and custom analysis
- Function Reference - Complete API documentation
Key Features
Automatic Background Filtering
Raster extraction filters out non-content pixels: - Transparent pixels - Near-white colors (#f[fedc8a]*) - Near-black colors (#0[012]*)
This ensures metrics reflect actual artwork content, not canvas background.
Prediction Models
When Procreate stats aren’t available (e.g., photos of physical art), estimate metrics from color count:
# Extract color count
rast_data <- get_image_rast("/path/to/artwork.png")
n_colors <- nrow(rast_data$colors)
# Predict missing metrics
predict_strokes(n_colors)
predict_minutes(n_colors)Predictions use ML models trained on verified artwork data. Actual Procreate stats are always preferred when available.
Metric Framework Reference
Access the authoritative 16-metric benchmark framework:
# Get all metric definitions
get_metric_definitions()
# Check which metrics artbenchmark computes
get_artbenchmark_metrics()
# Lookup display names for UI
get_metric_name("canvas_coverage") # "Canvas Coverage"⚠️ Migration Notice
calc_percentile() Deprecated (v0.7.0)
calc_percentile() has been moved to the artcore package to maintain proper package dependency hierarchy.
The function in this package now throws an error with migration instructions. See ?artcore::calc_percentile for documentation.
Why this change? To respect the dependency hierarchy: artcore ← artutils ← artbenchmark
Development
For AI agent instructions and coding standards, see AGENTS.md.
devtools::test()
devtools::check()
pkgdown::build_site()Proprietary - Do Not Distribute
