Skip to the content

Stream of Consciousness
Thoughts about photography and general geekishness
  • About
  • Contact
  • ShinyPhoto
  • Redbubble
  • photos
    • Landscape
    • nature
    • Drone
    • Scotland
      • Perthshire
        • Perth
      • Highlands
    • landscape
    • Social Commentary
      • urban-landscape
  • words
X
Contact Us
  • Home
  • 2026
  • March
  • 14
  • Vibe-Codin’: Photographic Image Quality Wrangling

Vibe-Codin’: Photographic Image Quality Wrangling

spodzone
2026-03-14
art Geek photos story words

tl;dr: https://github.com/spodzone/iq/ exists

About 13 years ago, I bought the book Machine Learning in R as a way to teach myself both the concepts and the language. In many ways, that worked. It made a great foundation for understanding the processes of machine learning (training models, analysing models, running models on novel data) across increasingly complex model designs. (I still have favourable memories of Random Forests.)

It was around that time that Google Magenta was coming up with increasingly complex deep neural networks for solving various problems – “hey look we can generate music in the style of Bach!” and all that.

Super-Resolution

A drone photo of Ballantrae, on the Ayrshire coast at the end of the Stinchar fault, a noteworthy ophiolite zone

In my photography, I’m unashamedly proud of pixel-peeping – and use a variety of computational photographic techniques to maximize the image quality. One of the more useful ideas that stuck in my mind was single-image super-resolution. Rather than inventing detail from whole cloth, you train a model based on existing data such that it learns the differences between an image at its natural size and the same thing arrived at by downsampling and upscaling – effectively, instead of storing “this is a dog, this is a mountain”, you train it “these are the kinds of artefacts you’ll get when using Lanczos-4 to upscale”. Those residuals can then be applied to other images…

Last year I bought a comparatively small GPU for the linux workstation upstairs. The improvement in some workflows was mind-blowing: generating 4k thumbnails for youtube videos with ComfyUI used to take 2-3 minutes on the old M2 macbook; on the GPU box, that was down to under 10 seconds.

Some years ago, I used entirely open-source applications for photography. RawTherapee was a particular favourite for RAW conversion, darktable for polishing/finishing/editing, digiKam for organizing everything. But… the actual blending of HDR and focus-bracket stacks that defines much of my photography was either done painstakingly by hand in Affinity or Luminar Neo (which, to be fair, are very reliable at handling distortion and weird alignment patterns), or with a veritable hotch-potch of zsh scripts that really don’t deserve to see the light of day, kludging together align_image_stack, imagemagick’s convert, enfuse and exiftool and other things in the hope that the subframes would align properly. They often didn’t, if there was anything wonky in RawTherapee’s handling of the lens distortion, but at least they could iterate over a set of subdirectories in batch.

So, long story about to get shorter – after wasting a lot of time doing battle with VS Codium and various extensions, I subscribed to Cursor and set it up to use GLM-5. Before I knew it, a script was born that implemented my single-image super-resolution algorithm. No more reliance on Lanczos-4 or other weird and wonderful but all inherently limited upscaling algorithms! Best of all, because I’ve been careful about pixel detail and in any case the script works by generating its own temporary “ground truth” by downscaling the source photo by a factor of 2 so the source image’s pixel-quality isn’t hugely significant anyway, I can train the model on my own photographic archives.

Image Blending

Anyway, from there it was the work of a moment to add a couple more python scripts I find useful. In particular, pic3blend.py (named approximately after a former zsh function) implements all the image-blending I could ever want.

Here’s how it works. I return home after an afternoon shooting stuff out & about and filter my photos down to things that are worth attempting some processing on. These RAW images get converted with either DxO or RawTherapee. The resultant 16-bit TIFFs are moved into subdirectories like:

  • ~/Pictures/offloads/20269315-somewhere/fuji/converted/ :
  • coll-hdr-01
  • coll-hdr-02
  • coll-hdr-03
  • …
  • coll-focus-01
  • coll-focus-02
  • coll-focus-03
  • coll-focus-04
  • …
  • coll-mean-01
  • coll-mean-02
  • coll-mean-03
  • …

From this converted directory, I run the new pic3blend.py . It loops over all the coll-* directories it finds, upscales or super-resolves every image within them, aligns the larger images, detects and fixes ghosting artefacts and applies the relevant blend mode (either derived from the directory name, as above, or overridden with the --mode= parameter.

Evidence is that it works, too. On the left, a view of a single frame blown-up 200% in digiKam; on the right, 3 frames super-resolved using my new script & model and HDR blended with enfuse.

I’m well impressed. It’s almost like maths works, or something.

Timelapse Linear Interpolation

The third script is a quick and lightweight partial reimplementation of something I wrote many years ago to solve pain-points in timelapse photography. Frequently, timelapse sequences can be subject to various glitches in the time axis – battery goes flat, exposure time vs intervalometer vs slow SD card lead to skipping an interval, or in the cases of aurora or NLCs the subject-matter is so dark that it takes long exposures to get any light in the camera so you can’t take that many frames to run the sequence directly at the faster frame-rate.

Enter interpolation. This script takes three parameters:

python timelapse-v2.py in-dir no-frames out-dir

It reads all the image files in in-dir, determines their timestamp from either the DateTimeOriginal field in the EXIF metadata or from the files’ mtime on disk; it divides that block of time into no-frames slices; it decides which two images fit either side of each slice and interpolates linearly between those two frames; outputs go in out-dir.

The results can be blended using ffmpeg:

cat out-dir/* | ffmpeg -i - -r 50 -qscale 0 -y timelapse.mp4

Github Repository

So, that’s how this little image-quality repository came about. If you like it, if you can cope with vibe-coded python, feel free to enjoy. They solve my problems; if they solve some of yours as well, all to the good. No warranties, no guarantees, GPL v3.

AI, batch processing, blending, focus stacking, hdr, image quality, LLM, lucky imaging, machine-learning, open-source, photography, python, scripts, stacking, super-resolution, timelapse, vibe coding

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Post navigation

Previous post:One Month and Twenty Years

Recent Posts

  • Vibe-Codin’: Photographic Image Quality Wrangling
  • One Month and Twenty Years
  • Concerning Quality
  • Generosity, (Dis)Honesty and Copyright
  • Replacing decades-old zsh function. It’s a vibe.
  • Sunrise at Dunnottar
  • New Toy: Meet the Wobbleometer(TM)
  • Evening bike-ride
  • vdB14 and vdB15, Camelopardalis
  • Canon vs Fuji: R5 Fail
March 2026
S M T W T F S
1234567
891011121314
15161718192021
22232425262728
293031  
« Nov    

Categories

  • Argyll (8)
  • Bookmarks (1)
  • Geek (17)
  • geo (1)
  • home and garden (52)
    • Dog (4)
  • landscape (58)
  • nature (343)
    • Astronomy (9)
    • closeup (42)
    • Landscape (279)
      • intimate-landscape (111)
      • Skyscape (1)
      • urban-landscape (20)
    • rocks (1)
  • night (14)
  • Perth (17)
  • photos (467)
    • art (83)
    • daily (130)
    • Drone (19)
    • mobile photos (173)
  • religion (8)
    • christian (7)
  • River Tay (4)
  • Scotland (207)
    • Aberdeenshire (2)
    • Angus (1)
    • Highlands (72)
      • Assynt (2)
      • Glen Affric (10)
      • Glencoe/Glen Etive (1)
      • Lochaber (3)
    • Perthshire (78)
      • Glen Devon (1)
      • Glen Lyon (1)
      • Loch Tay (1)
      • Rannoch (8)
      • Strathearn (19)
  • Social Commentary (47)
  • Uncategorized (38)
  • urban (16)
  • water (36)
  • words (59)
    • story (16)
  • About
  • Contact
  • ShinyPhoto
  • Redbubble
  • photos
    • Landscape
    • nature
    • Drone
    • Scotland
      • Perthshire
        • Perth
      • Highlands
    • landscape
    • Social Commentary
      • urban-landscape
  • words
Footer Image

The Modern Art Gallery WordPress Theme is a sleek, visually striking, and feature-rich theme designed for artists, art galleries, and creative professionals looking to establish a powerful online presence. Perfect for showcasing fine art, digital illustrations, photography, or contemporary artwork, this artistic WordPress theme offers a clean and elegant layout that enhances the presentation of any visual medium. Built specifically for online art galleries, painter portfolios, and creative exhibition platforms, the theme includes beautifully structured grid layouts, fullscreen art showcases, and interactive gallery blocks.

Calendar

March 2026
S M T W T F S
1234567
891011121314
15161718192021
22232425262728
293031  
« Nov    

Enter Keywords Here

All rights reserved.
Theme: Modern Art Gallery By OMEGA Powered by WordPress.
To the Top ↑