# Install from GitHub
pak::pkg_install("artalytics/artpipelines")
library(artpipelines)Introduction
artpipelines is the artwork processing engine for the Artalytics platform. It orchestrates the complete workflow from raw artwork submission to fully populated database records, handling:
- Procreate canvas validation and structure assessment
- Asset upload to CDN storage (vault, public, data buckets)
- Metadata extraction (creation dates, timestamps, image dimensions)
- Timelapse video processing and frame extraction
- AI-powered style classification and artwork profiling
- Benchmark calculation against artist portfolios
- Certificate of authenticity generation
This guide walks you through the core workflows.
Installation
Configuration
Before using artpipelines, configure environment variables for database, CDN, and AI services. See the README Environment Variables section for complete details.
Core Workflow: Processing an Artwork
The main entry point is run_pipeline(), which executes a complete artwork processing workflow in sequence.
Step 1: Validate the Procreate Canvas
Before committing to a full pipeline run, validate that the uploaded canvas contains genuine artwork:
canvas_path <- "path/to/artwork.procreate"
# Assess canvas structure and creative evidence
assessment <- assess_procreate_canvas(canvas_path)
# Check the classification
assessment$classification
# Possible values:
# - "DEFINITELY_CREATIVE" - Has timelapse AND sufficient tile content
# - "PROBABLY_CREATIVE" - Has timelapse OR sufficient tiles
# - "INDETERMINATE" - Valid structure but weak creative evidence
# - "NOT_CREATIVE" - Appears empty or invalid
# Review the evidence
assessment$creative_evidence # "definite", "probable", "weak", "none"
assessment$n_mp4_nonempty # Count of timelapse video segments
assessment$n_tile_files # Count of raster tile/chunk filesStep 2: Prepare Input Files
The pipeline expects these files:
| File | Description |
|---|---|
file_image |
Main artwork PNG (high resolution) |
file_canvas |
Original .procreate canvas file |
file_video |
Timelapse MP4 video |
file_stats |
Screenshot of Procreate stats panel |
file_variants |
(Optional) Directory of PNG variants |
Step 3: Run the Pipeline
result <- run_pipeline(
# UUIDs - obtain from your application or generate with artcore
artist = "746b8207-72f5-4ab6-8d19-a91d03daec3d",
artwork = "99a61148-1d3b-4340-8cf6-92ad26046b0f",
collection = "77102117-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
# Metadata
artist_name = "Bobby Fatemi",
art_title = "Portrait of Jeezy",
art_story = "Inspired by hip-hop culture and urban artistry",
# Input files
file_image = "/uploads/main.png",
file_canvas = "/uploads/canvas.procreate",
file_video = "/uploads/timelapse.mp4",
zip_frames = NULL, # Optional pre-extracted frames
file_stats = "/uploads/stats-screenshot.png",
file_variants = NULL # Optional variants directory
)Step 4: Understand the Results
The pipeline returns a list of data.tables ready for database insertion:
names(result)
# [1] "artist" "artwork"
# [3] "artwork_colors" "artwork_frame_analytics"
# [5] "artwork_hash" "artwork_index"
# [7] "artwork_meta" "artwork_paths"
# [9] "artwork_profiles" "artwork_stats"
# [11] "artwork_styles" "global_styles"
# [13] "artwork_opensea"
# The main artwork record
result$artwork_index
#> artist_uuid collection_uuid
#> 1: 746b8207-72f5-4ab6-8d19-a91d03daec3d 77102117-xxxx-...
#> art_uuid art_name art_title
#> 1: 99a61148-1d3b-4340-8cf6-92ad26046b0f portrait_of_jeezy Portrait of Jeezy
# Processing metrics
result$artwork_stats
#> drawing_hours brush_strokes n_unique_colors complexity_score
#> 1: 12.5 45000 1250 0.85Extraction Functions
For finer control, use individual extraction functions:
Extract Creation Date
create_date <- extract_create_date(artist, artwork, file_canvas)
# Returns POSIXct timestamp from the earliest MP4 segmentExtract Image Metadata
meta <- extract_image_meta(artist, artwork, file_image)
# Returns list with:
# - meta_1: width, height, filesize
# - meta_2: Full EXIF data as JSONExtract Canvas Statistics
stats <- extract_stats_procreate(artist, artwork, fp = file_canvas, new_utc)
# Returns data.table with drawing_hours, brush_strokes, n_unique_colorsVerify Creation Period
For provenance verification, compute a defensible creation window:
window <- verify_creation_period(file_canvas, verbose = TRUE)
window$start_utc # Earliest MP4 creation time
window$stop_utc # Latest tile write time
window$interval_utc # lubridate::interval
window$tz_offset_hours # Inferred timezone offset
window$start_confidence # "high" (from MP4) or "low"
window$stop_confidence # "moderate" (from filtered tiles)Job Management
Track pipeline progress with the job management functions:
# Add a new job (called automatically by run_pipeline)
job_id <- job_add(artist, artwork, art_title)
# Update job status during processing
job_update(job_id, msg = "Processing frames", progress = 50)
# Check job status
job <- job_get(job_id)
job$status # "Running", "Success", "Error"Next Steps
- Quickstart - Hands-on tutorial with step-by-step examples
- Advanced Workflow - Complex use cases and batch processing
- Function Reference - Complete API documentation
