amayer5125 is savage
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Example pipeline: OpenRouter photo enhancement (Darktable export → cloud edit)."""
|
||||
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
from imagepipeline import Pipeline
|
||||
|
||||
REPO_ROOT = Path(__file__).resolve().parents[1]
|
||||
ENV_FILE = REPO_ROOT / ".env"
|
||||
|
||||
# Change this to your Darktable export folder.
|
||||
INPUT = Path("/home/frank/tmp/aiedittest")
|
||||
|
||||
# Optional: where run folders are created (defaults to current working directory).
|
||||
OUTPUT_BASE = Path.home() / "pipeline_output"
|
||||
|
||||
OPENROUTER_PROMPT = (
|
||||
"Subtle photo enhancement only. Improve exposure, color, and skin tones. "
|
||||
"Sharpen where the blur seems to be unintended."
|
||||
"Keep the same people, poses, background, and composition. "
|
||||
"Natural, realistic look — no oversaturation or plastic skin."
|
||||
"Do not change image ratio, do not crop or enlarge the image, just improve the photo."
|
||||
"In group photos, improve the photo of the group, not the individual photos."
|
||||
"Also in group photos make faces same brightness and remove any glare or reflections."
|
||||
"Think of it like an amateur developed the RAW file in Lightroom and you are the senior who makes final touches to make it look professional."
|
||||
)
|
||||
|
||||
# Test cheap with Klein; switch to flux.2-pro or flux.2-max for final exports.
|
||||
OPENROUTER_MODEL = "x-ai/grok-imagine-image-quality"
|
||||
|
||||
|
||||
def _load_env_file(path: Path) -> None:
|
||||
if not path.is_file():
|
||||
return
|
||||
for raw_line in path.read_text(encoding="utf-8").splitlines():
|
||||
line = raw_line.strip()
|
||||
if not line or line.startswith("#"):
|
||||
continue
|
||||
key, sep, value = line.partition("=")
|
||||
if not sep:
|
||||
continue
|
||||
key = key.strip()
|
||||
value = value.strip()
|
||||
if len(value) >= 2 and value[0] == value[-1] and value[0] in "\"'":
|
||||
value = value[1:-1]
|
||||
os.environ.setdefault(key, value)
|
||||
|
||||
|
||||
def main() -> None:
|
||||
_load_env_file(ENV_FILE)
|
||||
|
||||
with Pipeline(
|
||||
name="example_ai",
|
||||
input_dir=INPUT,
|
||||
output_base=OUTPUT_BASE,
|
||||
) as p:
|
||||
p.step(
|
||||
"openrouter_edit",
|
||||
inputs="input",
|
||||
prompt=OPENROUTER_PROMPT,
|
||||
model=OPENROUTER_MODEL,
|
||||
max_edge=2048,
|
||||
)
|
||||
# Local CPU fallback (usually worse on already-graded Darktable exports):
|
||||
# exp = p.step("ai_exposure", inputs="input", max_edge=2048, strength=0.5)
|
||||
# p.step("ai_tone_map", inputs=exp, strength=0.5)
|
||||
output_root = p.run()
|
||||
|
||||
print(f"Pipeline finished. Output: {output_root}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Example pipeline: convert all exported images to grayscale."""
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from imagepipeline import Pipeline
|
||||
|
||||
# Change this to your Darktable export folder.
|
||||
INPUT = Path("/path/to/darktable/export")
|
||||
|
||||
# Optional: where run folders are created (defaults to current working directory).
|
||||
OUTPUT_BASE = Path.home() / "pipeline_output"
|
||||
|
||||
|
||||
def main() -> None:
|
||||
with Pipeline(
|
||||
name="example_grayscale",
|
||||
input_dir=INPUT,
|
||||
output_base=OUTPUT_BASE,
|
||||
) as p:
|
||||
gray = p.step("imagemagick_grayscale", inputs="input")
|
||||
# Chain another step on the result:
|
||||
# p.step("imagemagick_grayscale", inputs=gray, colorspace="Gray")
|
||||
output_root = p.run()
|
||||
|
||||
print(f"Pipeline finished. Output: {output_root}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,121 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Baxxter pipeline: rembg variants composited over backgrounds and originals."""
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from imagepipeline import Pipeline
|
||||
|
||||
INPUT = Path("/home/frank/pics/20260525_Shooting Baxxter Boys/darktable_exported")
|
||||
OUTPUT_BASE = Path.home() / "pipeline_output"
|
||||
|
||||
GRADIENT_COLOR1 = "#d7fd00ff"
|
||||
GRADIENT_COLOR2 = "#fc0adeff"
|
||||
|
||||
GMIC_STEREO = "-gcd_stereo_img 0,0,2.028,1,1.714,3.06,4,1,0"
|
||||
GMIC_DROP_SHADOW = "-fx_drop_shadow3d 0,0,0,10,1,1,2,0.5,252,10,222,200,0"
|
||||
GMIC_BWRECOLOR = (
|
||||
"-fx_bwrecolorize 0,0,0,0,0,1,0,2,252,10,222,255,215,253,0,255,"
|
||||
"158,137,189,255,224,191,228,255,215,253,0,255,255,255,255,255,255,255,"
|
||||
"255,255,215,253,0,255"
|
||||
)
|
||||
GMIC_GRADIENT_A = (
|
||||
'-fx_custom_gradient 0,0,0,1,2,1,0,128,100,100,2,0,1,0,"",1,0,215,253,0,255,'
|
||||
"252,10,222,255,255,255,0,255,255,255,255,255,0,255,255,255,0,255,0,255,0,0,"
|
||||
"255,255,128,128,128,255,255,0,255,255,0,0,0,0"
|
||||
)
|
||||
GMIC_GRADIENT_B = (
|
||||
'-fx_custom_gradient 0,0,0,1,2,1,0,128,100,100,2,0,1,0,"",1,0,252,10,222,255,'
|
||||
"215,253,0,255,255,255,0,255,255,255,255,255,0,255,255,255,0,255,0,255,0,0,"
|
||||
"255,255,128,128,128,255,255,0,255,255,0,0,0,0"
|
||||
)
|
||||
GMIC_JPR_SMOOTH = "-jpr_gradient_smooth 0,1.5"
|
||||
|
||||
|
||||
def main() -> None:
|
||||
with Pipeline(
|
||||
name="baxxter",
|
||||
input_dir=INPUT,
|
||||
output_base=OUTPUT_BASE,
|
||||
) as p:
|
||||
rembg_out = p.step("rembg", inputs="input")
|
||||
|
||||
white_bg = p.step("imagemagick_fill", inputs="input", color1="#ffffff")
|
||||
black_bg = p.step("imagemagick_fill", inputs="input", color1="#000000")
|
||||
gradient_45_bg = p.step(
|
||||
"imagemagick_fill",
|
||||
inputs="input",
|
||||
color1=GRADIENT_COLOR1,
|
||||
color2=GRADIENT_COLOR2,
|
||||
gradient=True,
|
||||
angle=45,
|
||||
)
|
||||
gradient_radial_bg = p.step(
|
||||
"imagemagick_fill",
|
||||
inputs="input",
|
||||
color1=GRADIENT_COLOR1,
|
||||
color2=GRADIENT_COLOR2,
|
||||
gradient=True,
|
||||
radial=True,
|
||||
)
|
||||
grayscale = p.step("gmic_grayscale", inputs="input")
|
||||
|
||||
rembg_stereo = p.step("gmic", inputs=rembg_out, command=GMIC_STEREO)
|
||||
rembg_shadow = p.step("gmic", inputs=rembg_out, command=GMIC_DROP_SHADOW)
|
||||
rembg_bwrecolor = p.step("gmic", inputs=rembg_out, command=GMIC_BWRECOLOR)
|
||||
rembg_gradient_a = p.step("gmic", inputs=rembg_out, command=GMIC_GRADIENT_A)
|
||||
rembg_gradient_b = p.step("gmic", inputs=rembg_out, command=GMIC_GRADIENT_B)
|
||||
rembg_jpr_smooth = p.step("gmic", inputs=rembg_out, command=GMIC_JPR_SMOOTH)
|
||||
rembg_jpr_smooth_sized = p.step(
|
||||
"imagemagick_scale_crop",
|
||||
inputs=rembg_jpr_smooth,
|
||||
scale=1.05,
|
||||
)
|
||||
|
||||
# combine: white background, rembg
|
||||
p.step("composite", inputs=[white_bg, rembg_out])
|
||||
|
||||
# combine: black background, rembg
|
||||
p.step("composite", inputs=[black_bg, rembg_out])
|
||||
|
||||
# combine: linear gradient background, rembg
|
||||
p.step("composite", inputs=[gradient_45_bg, rembg_out])
|
||||
|
||||
# combine: radial gradient background, rembg
|
||||
p.step("composite", inputs=[gradient_radial_bg, rembg_out])
|
||||
|
||||
# combine: original, rembg (stereo), rembg
|
||||
stereo_mid = p.step("composite", inputs=["input", rembg_stereo])
|
||||
p.step("composite", inputs=[stereo_mid, rembg_out])
|
||||
|
||||
# combine: original, rembg (drop shadow), rembg
|
||||
shadow_mid = p.step("composite", inputs=["input", rembg_shadow])
|
||||
p.step("composite", inputs=[shadow_mid, rembg_out])
|
||||
|
||||
# combine: original, rembg (bw recolorize @ 50%), rembg
|
||||
bw_mid = p.step(
|
||||
"composite",
|
||||
inputs=["input", rembg_bwrecolor],
|
||||
foreground_opacity=0.5,
|
||||
)
|
||||
p.step("composite", inputs=[bw_mid, rembg_out])
|
||||
|
||||
# combine: rembg (custom gradient A), rembg
|
||||
p.step("composite", inputs=[rembg_gradient_a, rembg_out])
|
||||
|
||||
# combine: rembg (custom gradient B), rembg
|
||||
p.step("composite", inputs=[rembg_gradient_b, rembg_out])
|
||||
|
||||
# combine: original, rembg (jpr smooth, scaled), rembg
|
||||
smooth_mid = p.step("composite", inputs=["input", rembg_jpr_smooth_sized])
|
||||
p.step("composite", inputs=[smooth_mid, rembg_out])
|
||||
|
||||
# combine: original (grayscale), rembg
|
||||
p.step("composite", inputs=[grayscale, rembg_out])
|
||||
|
||||
output_root = p.run()
|
||||
|
||||
print(f"Pipeline finished. Output: {output_root}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Watermark pipeline: rembg + grayscale composite + darktable style."""
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from imagepipeline import Pipeline
|
||||
|
||||
# Darktable export folder.
|
||||
INPUT = Path("/home/frank/pics/20260517_Albershausen Crusaders - Biberach Beavers/darktable_exported/png")
|
||||
|
||||
# Where timestamped run folders are created.
|
||||
OUTPUT_BASE = Path.home() / "pipeline_output"
|
||||
|
||||
# darktable style name (must exist in ~/.config/darktable/styles/).
|
||||
STYLE = "Watermark F12.rocks"
|
||||
|
||||
|
||||
def main() -> None:
|
||||
with Pipeline(
|
||||
name="pipeline_watermark_f12",
|
||||
input_dir=INPUT,
|
||||
output_base=OUTPUT_BASE,
|
||||
) as p:
|
||||
rembg_out = p.step("rembg", inputs="input")
|
||||
grayscale = p.step("gmic_grayscale", inputs="input")
|
||||
combined = p.step("composite", inputs=[grayscale, rembg_out])
|
||||
p.step("darktable_style", inputs=combined, style=STYLE)
|
||||
output_root = p.run()
|
||||
|
||||
print(f"Pipeline finished. Output: {output_root}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user