summaryrefslogtreecommitdiff
path: root/photo-enhance.rb
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-03-24 11:16:45 +0200
committerPaul Buetow <paul@buetow.org>2026-03-24 11:16:45 +0200
commit8d61721196c9f6a6b841dc3bdbb9ea9dada61c82 (patch)
tree1e41306d0af9a727a7ade2afc875edc962e2731f /photo-enhance.rb
parent728bb6dc7d664f8dcc2d8c9905e7c3f1ae062e48 (diff)
Add SUPIR photo restoration + local colour corrections
- workflows/photo-enhance.json: replace Real-ESRGAN-only pipeline with SUPIR_Upscale (SUPIR-v0Q + SDXL base backbone). Parameters: 20 steps, scale_by=1.0 (original resolution), Wavelet colour fix, tiled VAE + tiled sampling for L40 VRAM headroom. - photo-enhance.rb: add ImageMagick colour corrections after download: S-curve contrast (-sigmoidal-contrast 3,50%), +20% saturation (-modulate 100,120,100), micro-contrast sharpening (-unsharp). These stack on top of SUPIR's internal Wavelet colour fix. - hyperstack.rb: update comfyui_install_script to install ComfyUI-SUPIR custom node and download both SUPIR-v0Q + sd_xl_base_1.0 on provision. - hyperstack.rb: extend status_config_loaders to auto-discover hyperstack-vm-photo.toml so --watch shows the photo VM. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'photo-enhance.rb')
-rwxr-xr-xphoto-enhance.rb18
1 files changed, 13 insertions, 5 deletions
diff --git a/photo-enhance.rb b/photo-enhance.rb
index 52be7b9..39f3942 100755
--- a/photo-enhance.rb
+++ b/photo-enhance.rb
@@ -321,15 +321,23 @@ class PhotoEnhancer
src_path
end
- # Convert the PNG downloaded from ComfyUI into the desired output format.
- # JPEG (.jpg/.jpeg) uses quality 92 to stay close to the original file size.
- # All other formats fall back to a straight copy (PNG stays PNG).
+ # Convert the PNG downloaded from ComfyUI into the desired output format and
+ # apply local colour corrections via ImageMagick:
+ # -sigmoidal-contrast 3,50% — gentle S-curve (lifts shadows, adds punch)
+ # -modulate 100,120,100 — +20% saturation (vibrance-style boost)
+ # -unsharp 0x1.5+0.7+0.02 — mild clarity / micro-contrast sharpening
+ # PNG output gets the same corrections but stays lossless.
def convert_to_original_format(src_png, dest_path, original_ext)
+ color_args = [
+ '-sigmoidal-contrast', '3,50%',
+ '-modulate', '100,120,100',
+ '-unsharp', '0x1.5+0.7+0.02'
+ ]
case original_ext
when '.jpg', '.jpeg'
- system('magick', src_png, '-quality', '92', dest_path)
+ system('magick', src_png, *color_args, '-quality', '92', dest_path)
else
- FileUtils.cp(src_png, dest_path)
+ system('magick', src_png, *color_args, dest_path)
end
end