summaryrefslogtreecommitdiff
path: root/smart_photo_node.py
AgeCommit message (Collapse)Author
2026-03-25photo-enhance: reduce contrast a further 0.05 across all scene profilesPaul Buetow
Second round of user-feedback contrast reduction (still a bit high after -0.10): landscape/golden_hour/overcast/street 1.10→1.05 indoor/beach/default 1.05→1.00 (portrait/night already at 1.00) Retrospective fix applied to 26 existing _e.jpg photos via: magick -function polynomial 0.9545,0.02275 (equivalent to undoing 1.10 and re-applying 1.05 around the 0.5 midpoint) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-25photo-enhance: reduce contrast across all scene profiles by 0.10Paul Buetow
User feedback: contrast was too high on enhanced photos (~1.20 felt heavy). Reduced all PROFILES contrast values by 0.10 (floor 1.00): portrait 1.10→1.00, landscape 1.20→1.10, night 1.05→1.00, indoor 1.15→1.05, golden_hour 1.20→1.10, overcast 1.20→1.10, beach 1.15→1.05, street 1.20→1.10, default 1.15→1.05 Retrospective fix applied to 25 existing _e.jpg photos via: magick -function polynomial 0.9167,0.04167 (equivalent to undoing 1.20 and re-applying 1.10 around the 0.5 midpoint) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-25photo-enhance: add CodeFormerRestore stub and ximgproc fallbackPaul Buetow
Two runtime fixes discovered during testing: 1. CodeFormerRestore stub: CodeFormer custom node (comfyui-reactor-node) is not installed on fresh VMs. Added a passthrough stub in smart_photo_node.py that keeps the workflow intact while allowing the other stages to work. Registered last so the real node from a separately installed package takes priority if present. 2. Guided filter fallback: cv2.ximgproc.guidedFilter requires opencv-contrib (opencv-contrib-python-headless). Added a try/except in _apply_detail that falls back to cv2.bilateralFilter when ximgproc is unavailable. The contrib package was also installed on the VM for full quality. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-25photo-enhance: adaptive pipeline with conditional ESRGAN and blended scene ↵Paul Buetow
grading Addresses all five priority improvements from photo-enhance-review.md: 1. Conditional ESRGAN (ConditionalESRGANBlend node): portrait and night scenes skip Real-ESRGAN entirely; indoor/golden_hour use a reduced blend (0.25–0.60); landscape/beach keep full strength. Confidence- weighted ratios from CLIP scores soften hard scene-boundary transitions. 2. Blended CLIP scene profiles: CLIPSceneDetect now outputs top-3 scene scores as a normalised JSON string. AdaptivePhotoGrade blends the matching grading profiles weighted by confidence instead of hard- switching on the argmax label — a 55/35/10 landscape/golden_hour/overcast split produces a weighted average of those three profiles. 3. Conservative depth defaults: DepthSelectiveSharpen background_blur changed from 0.50 to 0.0 (disabled by default). Foreground sharpening is kept; background blur can be re-enabled explicitly per shot. 4. EXIF/ICC preservation: copy_exif() in photo-enhance.rb uses exiftool to restore capture time, camera/lens info, GPS, and ICC profile from the source file onto the enhanced JPEG after ComfyUI strips metadata. Embedded thumbnail/preview are excluded to avoid showing the old image. 5. Provenance logging: prompt_id is now passed into the metadata markdown report. WritePhotoMetadata emits scene_scores and esrgan_mode into the JSON sidecar. The markdown report now shows top-3 scene confidences, ESRGAN mode, and ComfyUI prompt ID for reproducibility. Workflow restructured: CLIPSceneDetect now runs on the original image (before ESRGAN) so scene scores are available to gate the upscaler. ConditionalESRGANBlend (node 16) inserted between ESRGAN downscale and CodeFormer. All downstream nodes receive scene_scores via node 11 outputs. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-24photo-enhance: full AI pipeline with scene-adaptive enhancementPaul Buetow
Complete overhaul of the ComfyUI photo enhancement stack: Pipeline (workflows/photo-enhance.json): - Real-ESRGAN realesr-general-x4v3: 4x upscale at full 4K input (no pre-downscale, preserves all original detail before AI sees it), output scaled back to 4K - CodeFormer fidelity=0.7: GPU neural face detection + restoration - CLIP ViT-B/32: zero-shot scene classification (portrait/landscape/night/ indoor/golden_hour/overcast/beach/street) - AdaptivePhotoGrade: scene-tuned exposure/contrast/saturation/detail using guided-filter clarity enhancement; simple linear exposure shift (replaces Reinhard tonemapping which was darkening already-exposed Fuji photos) - SkyEnhance: HSV sky mask (blue sky + clouds + sunset) with spatial prior, graduated exposure and saturation boost for sky regions - DepthSelectiveSharpen: Depth Anything V2 Small depth map → foreground sharpening, background softening - WritePhotoMetadata: writes per-photo JSON to ComfyUI output dir smart_photo_node.py: implements all 5 new ComfyUI custom nodes photo-enhance.rb: - Downloads per-photo metadata JSON from ComfyUI and renders it as a human-readable _e.md report alongside each enhanced JPEG - inject_input now also patches WritePhotoMetadata with prefix + source filename - Updated pipeline description in header comments photo-compare.rb: GTK4 side-by-side comparison GUI — show original vs enhanced, keyboard shortcuts O/E to move preferred version to outdir, Space to skip, auto-rescans as new photos arrive Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>