Ölgemälde auf drei Wegen — Grundoperationen, Kuwahara, PhotoCraft
Stellt die beiden bisherigen Ölmal-Rezepte der Engine — bilateraler Weichzeichner mit Tontrennung und der Kuwahara-Filter — neben PhotoCrafts Ölfarbe, deren Pinselstriche dem Bild folgen und wie pastoser Farbauftrag beleuchtet sind. Ein 2×2-Bogen mit dem Original.
INPUT
OUTPUT
JavaScript
// Three ways to oil paint — engine primitives vs. Kuwahara vs. PhotoCraft Oil Paint
// demo_photocraft_oil_compare.js
//!INPUT: INPUT
//!OUTPUT: OUTPUT
//!PARAM: TILE:integer=420,min=128,max=1024
//!PARAM: KUWAHARA_RADIUS:integer=6,min=1,max=20
//!PARAM: STYLIZATION:number=6,min=0.1,max=10, CLEANLINESS:number=6,min=0,max=10
//!PARAM: LABELS:boolean=true
// The engine had two oil-paint recipes before PhotoCraft arrived; this sheet puts
// them next to PhotoCraft's port of Photoshop's Filter › Stylize › Oil Paint.
//
// Primitives bilateralBlur ×2 → saturation → posterize → sharpen
// (the demo_oilpaint recipe: flat, poster-like, no brush texture)
// Kuwahara img.kuwahara(r) (demo_kuwahara_paint: soft painterly patches)
// PhotoCraft filter("oilPaint") — brush strokes follow the image structure
// and get lit like impasto (lighting, angle, shine).
//
// Layout: [ Original | Primitives ]
// [ Kuwahara | PhotoCraft ]
const T = Math.round(TILE);
const src = Engine.loadImage(INPUT);
const k = T / Math.min(src.width, src.height);
src.resize(Math.max(T, Math.round(src.width * k)), Math.max(T, Math.round(src.height * k)));
src.crop(Math.floor((src.width - T) / 2), Math.floor((src.height - T) / 2), T, T);
const primitives = src.clone();
for (let i = 0; i < 2; i++) primitives.bilateralBlur(9, 0.30, 12);
primitives.saturation(1.2).posterize(8).sharpen(0.4);
const kuwahara = src.clone().kuwahara(KUWAHARA_RADIUS);
const photocraft = src.clone().filter("oilPaint", {
stylization: STYLIZATION,
cleanliness: CLEANLINESS,
bristleDetail: 6,
lighting: true,
shine: 1.5,
});
const tiles = [
[src.clone(), "Original"],
[primitives, "Primitives"],
[kuwahara, "Kuwahara"],
[photocraft, "PhotoCraft Oil Paint"],
].map(([t, label]) => {
if (LABELS) {
const size = Math.max(12, Math.round(T / 22));
t.drawText(label, T / 2, T - size, {
font: "Inter", size, anchor: "middle", color: new Pixel(1, 1, 1, 0.9),
});
}
return t;
});
tiles[0].montageH(tiles[1])
.montageV(tiles[2].montageH(tiles[3]))
.save(OUTPUT);