@@ -0,0 +1,294 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Sports — generic red/yellow looks for sideline / blog edits.
|
||||
|
||||
Keeps proven composites from crusaders-goblue (recolored), plus four new
|
||||
BG/FG G'MIC blend recipes.
|
||||
"""
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from imagepipeline import Pipeline
|
||||
|
||||
INPUT = Path(
|
||||
"/home/frank/pics/20260726_Bikepark Winnenden/darktable_exported/png"
|
||||
)
|
||||
|
||||
OUTPUT_BASE = Path.home() / "pipeline_output"
|
||||
EXISTING_OUTPUTS: dict[str, Path] = {}
|
||||
CONTINUE_FROM: Path | None = Path(
|
||||
"/home/frank/pipeline_output/sports_260726190157"
|
||||
)
|
||||
|
||||
# Standard sports red / yellow
|
||||
COLOR1 = "#e30613" # 227,6,19
|
||||
COLOR2 = "#ffcc00" # 255,204,0
|
||||
R1, G1, B1 = 227, 6, 19
|
||||
R2, G2, B2 = 255, 204, 0
|
||||
ALPHA1 = 160
|
||||
ALPHA2 = 110
|
||||
|
||||
# --- shared / kept from goblue ---
|
||||
GMIC_TONE_MAPPING = "-fx_map_tones 0.5,0.7,0.1,30,0"
|
||||
GMIC_ANGULAR = "-fx_blur_angular 2.5,50,50,0,0,7,0"
|
||||
GMIC_INK_WASH = "-fx_ink_wash 0.14,23,0,0.5,0.54,2.25,0,0,0,0,0,0,0,0,0"
|
||||
|
||||
GMIC_CUTOUT = "-fx_cutout 4,0.5,4,1"
|
||||
GMIC_HUFFMAN_GLITCHES = "-fx_huffman_glitches 30,0,25,0,0,0,0,0,50,50"
|
||||
GMIC_LOCAL_SIMILARITY = "-local_similarity_mask 50,50,50,128,4,10"
|
||||
GMIC_LUMA_INVERT = "-Lylejk_Luma_Invert 1,0"
|
||||
GMIC_CRAYONGRAFFITI = "-fx_crayongraffiti2 300,50,1,0.4,12,1,2,2,0"
|
||||
|
||||
GMIC_BOKEH = (
|
||||
f"-fx_bokeh 3,5,0,30,8,4,0.3,0.2,{R1},{G1},{B1},{ALPHA1},0.7,30,20,20,1,2,"
|
||||
f"{R2},{G2},{B2},{ALPHA2},0.15"
|
||||
)
|
||||
|
||||
GMIC_LOOSE_PHOTOS = (
|
||||
"-fx_loose_photos 60,40,50,100,50,360,0,2,255,255,255,50,25,0,0,0,0,0,0,50,1,1,1"
|
||||
)
|
||||
GMIC_BLUR_LINEAR = "-fx_blur_linear 10,0.5,0,0,2,7,0"
|
||||
GMIC_TUNNEL = "-fx_tunnel 4,80,50,50,0.2,0"
|
||||
|
||||
# --- new BG/FG recipes (filter on copy → G'MIC blend → next layer) ---
|
||||
# Rainbowify + lchlightness / Autofill Coloring Book + interpolation
|
||||
GMIC_RAINBOWIFY_AUTOFILL = (
|
||||
"+fx_rep_rainbowify 0,0,100 blend lchlightness "
|
||||
"+gui_rep_acb 180,0,1,0,250000 blend interpolation"
|
||||
)
|
||||
# Hard Sketch + burn / Jpr Line Edges + add
|
||||
GMIC_HARDSKETCH_LINE_EDGES = (
|
||||
"+fx_hardsketchbw 300,50,1,0.1,20,0,4 blend burn "
|
||||
"+jpr_line_edges 2,2,4,1 blend add"
|
||||
)
|
||||
# Blur [Linear] + shapeaverage / Charred Plastic + blue
|
||||
GMIC_BLUR_CHARRED = (
|
||||
"+fx_blur_linear 10,0.5,0,0,2,7,0 blend shapeaverage "
|
||||
"+fx_charred_plastic 1,10,40,1,10,0,0,2,6,5,20,0,11 blend blue"
|
||||
)
|
||||
# Colored Pencils + hue / Black Crayon Graffiti + green
|
||||
GMIC_PENCILS_CRAYON = (
|
||||
"+fx_cpencil 1.3,50,20,2,2,1 blend hue "
|
||||
"+fx_crayongraffiti2 300,50,1,0.4,12,1,2,2,0 blend green"
|
||||
)
|
||||
|
||||
|
||||
def main() -> None:
|
||||
with Pipeline(
|
||||
name="sports",
|
||||
input_dir=INPUT,
|
||||
output_base=OUTPUT_BASE,
|
||||
existing_outputs=EXISTING_OUTPUTS or None,
|
||||
continue_from=CONTINUE_FROM,
|
||||
) as p:
|
||||
rembg_out = p.step("rembg", inputs="input", step_id="rembg_out")
|
||||
tone = p.step("gmic", inputs="input", command=GMIC_TONE_MAPPING, step_id="tone")
|
||||
|
||||
# ========== kept from goblue ==========
|
||||
angular = p.step(
|
||||
"gmic", inputs="input", command=GMIC_ANGULAR, step_id="angular"
|
||||
)
|
||||
vortex = p.step("composite", inputs=[angular, rembg_out], step_id="vortex")
|
||||
|
||||
ink = p.step("gmic", inputs=tone, command=GMIC_INK_WASH, step_id="ink")
|
||||
ink_press = p.step("composite", inputs=[ink, rembg_out], step_id="ink_press")
|
||||
|
||||
input_cutout = p.step(
|
||||
"gmic", inputs=tone, command=GMIC_CUTOUT, step_id="input_cutout"
|
||||
)
|
||||
cutout_mid = p.step(
|
||||
"composite", inputs=[tone, input_cutout], step_id="cutout_mid"
|
||||
)
|
||||
composite_cutout = p.step(
|
||||
"composite", inputs=[cutout_mid, rembg_out], step_id="composite_cutout"
|
||||
)
|
||||
|
||||
input_huffman = p.step(
|
||||
"gmic",
|
||||
inputs=tone,
|
||||
command=GMIC_HUFFMAN_GLITCHES,
|
||||
step_id="input_huffman_glitches",
|
||||
)
|
||||
huffman_mid = p.step(
|
||||
"composite",
|
||||
inputs=[tone, input_huffman],
|
||||
step_id="huffman_glitches_mid",
|
||||
)
|
||||
composite_huffman_glitches = p.step(
|
||||
"composite",
|
||||
inputs=[huffman_mid, rembg_out],
|
||||
step_id="composite_huffman_glitches",
|
||||
)
|
||||
|
||||
input_local_sim = p.step(
|
||||
"gmic",
|
||||
inputs=tone,
|
||||
command=GMIC_LOCAL_SIMILARITY,
|
||||
step_id="input_local_similarity",
|
||||
)
|
||||
local_sim_mid = p.step(
|
||||
"composite",
|
||||
inputs=[tone, input_local_sim],
|
||||
step_id="local_similarity_mid",
|
||||
)
|
||||
composite_local_similarity = p.step(
|
||||
"composite",
|
||||
inputs=[local_sim_mid, rembg_out],
|
||||
step_id="composite_local_similarity",
|
||||
)
|
||||
|
||||
input_crayon = p.step(
|
||||
"gmic",
|
||||
inputs=tone,
|
||||
command=GMIC_CRAYONGRAFFITI,
|
||||
step_id="input_crayongraffiti",
|
||||
)
|
||||
crayon_mid = p.step(
|
||||
"composite",
|
||||
inputs=[tone, input_crayon],
|
||||
step_id="crayongraffiti_mid",
|
||||
)
|
||||
composite_crayongraffiti = p.step(
|
||||
"composite",
|
||||
inputs=[crayon_mid, rembg_out],
|
||||
step_id="composite_crayongraffiti",
|
||||
)
|
||||
|
||||
input_bokeh = p.step(
|
||||
"gmic", inputs="input", command=GMIC_BOKEH, step_id="input_bokeh"
|
||||
)
|
||||
bokeh_mid = p.step(
|
||||
"composite", inputs=["input", input_bokeh], step_id="bokeh_mid"
|
||||
)
|
||||
composite_bokeh = p.step(
|
||||
"composite", inputs=[bokeh_mid, rembg_out], step_id="composite_bokeh"
|
||||
)
|
||||
|
||||
loose = p.step(
|
||||
"gmic", inputs="input", command=GMIC_LOOSE_PHOTOS, step_id="loose_photos"
|
||||
)
|
||||
loose_mid = p.step(
|
||||
"composite",
|
||||
inputs=["input", loose],
|
||||
mode="linearburn",
|
||||
foreground_opacity=0.5,
|
||||
step_id="loose_photos_mid",
|
||||
)
|
||||
composite_loose_photos = p.step(
|
||||
"composite",
|
||||
inputs=[loose_mid, rembg_out],
|
||||
step_id="composite_loose_photos",
|
||||
)
|
||||
|
||||
blur_linear = p.step(
|
||||
"gmic", inputs="input", command=GMIC_BLUR_LINEAR, step_id="blur_linear"
|
||||
)
|
||||
composite_blur_linear = p.step(
|
||||
"composite",
|
||||
inputs=[blur_linear, rembg_out],
|
||||
step_id="composite_blur_linear",
|
||||
)
|
||||
|
||||
tunnel = p.step("gmic", inputs="input", command=GMIC_TUNNEL, step_id="tunnel")
|
||||
composite_tunnel = p.step(
|
||||
"composite", inputs=[tunnel, rembg_out], step_id="composite_tunnel"
|
||||
)
|
||||
|
||||
luma_on_input = p.step(
|
||||
"gmic",
|
||||
inputs="input",
|
||||
command=GMIC_LUMA_INVERT,
|
||||
step_id="luma_invert_on_input",
|
||||
)
|
||||
luma_mul_mid = p.step(
|
||||
"composite",
|
||||
inputs=["input", luma_on_input],
|
||||
mode="multiply",
|
||||
foreground_opacity=0.5,
|
||||
step_id="luma_invert_multiply_mid",
|
||||
)
|
||||
composite_luma_invert_multiply = p.step(
|
||||
"composite",
|
||||
inputs=[luma_mul_mid, rembg_out],
|
||||
step_id="composite_luma_invert_multiply",
|
||||
)
|
||||
|
||||
# ========== new BG/FG recipes ==========
|
||||
rainbowify_autofill = p.step(
|
||||
"gmic",
|
||||
inputs="input",
|
||||
command=GMIC_RAINBOWIFY_AUTOFILL,
|
||||
step_id="rainbowify_autofill",
|
||||
)
|
||||
composite_rainbowify_autofill = p.step(
|
||||
"composite",
|
||||
inputs=[rainbowify_autofill, rembg_out],
|
||||
step_id="composite_rainbowify_autofill",
|
||||
)
|
||||
|
||||
hardsketch_line_edges = p.step(
|
||||
"gmic",
|
||||
inputs="input",
|
||||
command=GMIC_HARDSKETCH_LINE_EDGES,
|
||||
step_id="hardsketch_line_edges",
|
||||
)
|
||||
composite_hardsketch_line_edges = p.step(
|
||||
"composite",
|
||||
inputs=[hardsketch_line_edges, rembg_out],
|
||||
step_id="composite_hardsketch_line_edges",
|
||||
)
|
||||
|
||||
blur_charred = p.step(
|
||||
"gmic",
|
||||
inputs="input",
|
||||
command=GMIC_BLUR_CHARRED,
|
||||
step_id="blur_charred",
|
||||
)
|
||||
composite_blur_charred = p.step(
|
||||
"composite",
|
||||
inputs=[blur_charred, rembg_out],
|
||||
step_id="composite_blur_charred",
|
||||
)
|
||||
|
||||
pencils_crayon = p.step(
|
||||
"gmic",
|
||||
inputs="input",
|
||||
command=GMIC_PENCILS_CRAYON,
|
||||
step_id="pencils_crayon",
|
||||
)
|
||||
composite_pencils_crayon = p.step(
|
||||
"composite",
|
||||
inputs=[pencils_crayon, rembg_out],
|
||||
step_id="composite_pencils_crayon",
|
||||
)
|
||||
|
||||
p.step(
|
||||
"xcf_stack",
|
||||
inputs=[
|
||||
"input",
|
||||
rembg_out,
|
||||
vortex,
|
||||
ink_press,
|
||||
composite_cutout,
|
||||
composite_huffman_glitches,
|
||||
composite_local_similarity,
|
||||
composite_crayongraffiti,
|
||||
composite_bokeh,
|
||||
composite_loose_photos,
|
||||
composite_blur_linear,
|
||||
composite_tunnel,
|
||||
composite_luma_invert_multiply,
|
||||
composite_rainbowify_autofill,
|
||||
composite_hardsketch_line_edges,
|
||||
composite_blur_charred,
|
||||
composite_pencils_crayon,
|
||||
],
|
||||
step_id="xcf_looks",
|
||||
)
|
||||
|
||||
output_root = p.run()
|
||||
|
||||
print(f"Pipeline finished. Output: {output_root}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user