Borbin the 🐱

🔍 Search...
🔍
All terms must match (AND), "phrase" for exact matches, r"regex" for patterns (or ').
  • When Focus Follows the Subject

    📅 April 19, 2026 · Fotografie · ⏱️ 3 min

    The cake was late for the shoot. One piece was already gone, but there was still time for a quick addition to the family photo album.

    In earlier cake sessions, the usual approach was focus stacking: several frames with different focus points, later combined into one final image. That works well, but it also takes time, and this cake was clearly not in the mood for a longer production.

    So this time the job went to a tilt adapter and a 35mm1 lens. Instead of building the result from several images, the goal was to get the whole subject sharp in a single frame.

    A tilt setup does not simply give more depth of field. What it changes is the angle of the focus plane. Instead of running straight through the scene, the sharp area can be tilted to follow the subject. For something photographed from the side, that makes a real difference. The sharpness no longer has to run mainly from front to back; it can follow the shape of the cake much more naturally.

    That is what makes this so interesting. This cannot really be done in software without looking fake. The actual tilt effect has to come from the optics.

    A quick text test

    A simple text card as a test subject. With the tilted setup, the whole card stays sharp even though it sits at an angle. The current shooting angle is already very close to the limit of the setup, and at f/2 it gives a good impression of what the tilt adapter can do.

    1/40s f/2 ISO 320/26° f=35mm


    The Cake

    Here is the actual subject. One piece of the round cake is already missing, because cakes do not always wait patiently for the photographic process to begin.

    Even the sugar coating tells part of the story, with a few visible traces of a rather hurried arrival.

    1/40s f/2 ISO 800/30° f=35mm


    Same angle, no tilt: focus at the front The same view, but with the tilt set to zero. Focus is placed on the front part of the cake, and the rest falls away much more quickly.

    1/40s f/2 ISO 320/26° f=35mm


    Same angle, no tilt: focus at the back Again the same angle and no tilt, but this time focused farther back. The difference is easy to see, and it shows quite nicely what the tilt setup changes.

    1/40s f/2 ISO 320/26° f=35mm


    The Setup

    The full setup with the cake on the table and the camera floating in the air, carefully aligned and locked onto the target.

    1/25s f/4 ISO 400/27° 16-50mm f/2,8 VR f=25mm/37mm


    Tilt adapter and 35mm lens

    A closer look at the camera with the tilt adapter and the 35mm f/2 lens. A small addition, but one that changes the way this kind of image can be made.

    1/30s f/3,2 ISO 400/27° 16-50mm f/2,8 VR f=33mm/50mm

    If you look closely, you can still see the fine sand from the Sarasota beaches on the camera. This sand is everywhere. The camera bag did not escape either.

    Back on the Coffee Table

    Once the optics had done their job, the cake could finally continue with the coffee part of the story.

    1/30s f/2,8 ISO 320/26° 16-50mm f/2,8 VR f=40mm/60mm



    1. Nikon Nikkor Ai 35mm f2 ↩

  • A Cat at Dusk, ISO 12800

    📅 April 18, 2026 · Fotografie · ⏱️ 1 min

    Not every improvement in technology needs a big explanation. Sometimes it is just there in a simple picture taken late in the day, when the light is already fading and everything feels a little softer.

    These two photos of our cat were taken at dusk with the Nikon Z50 at ISO 12800 and f/2.8. What I like about them is how calm and natural they feel. The images are sharp, the detail is there, and the whole scene keeps its quiet evening mood.

    That is one of the nice things about modern cameras. They make this kind of picture easier and leave more room to focus on the subject, the light, and the moment.


    Two quiet moments in the fading evening light

    1/80s f/2,8 ISO 12800/42° 16-50mm f/2,8 VR f=50mm/75mm


    1/80s f/2,8 ISO 12800/42° 16-50mm f/2,8 VR f=50mm/75mm


    A closer look at the detail, and a nice reminder of how well this works these days.


    From the Z50 to JPEG for the web via Nikon NX Studio, with everything left at the default settings.

  • Obstkuchen zum Sonntagskaffee 🫐🍓

    📅 April 12, 2026 · Fotografie · ⏱️ 1 min

    Sonntagskaffee und ein Obstkuchen mit Erdbeeren, Brombeeren und Blaubeeren.

    Der Beerenmix wirkt auf dem Foto genauso gut wie auf dem Teller. Das Erdbeerrot setzt den Akzent, die dunklen Beeren bringen Tiefe, und die Struktur des Kuchenbodens hält das Bild zusammen. Genau so ein Motiv, das man gern etwas länger anschaut.

    1/30s f/4 ISO 250/25°


    Dazu gehört natürlich auch ein Kaffee.

    1/30s f/4 ISO 250/25° 16-50mm f/2,8 VR f=27mm/40mm


    Wie das Bild entstanden ist: Fokus-Stacking mit 5 Aufnahmen

    Damit die Details von vorne bis hinten scharf sind, habe ich das Kuchenfoto als Fokus-Stack aufgenommen. Dafür habe ich fünf Aufnahmen gemacht, jeweils mit einem anderen Fokuspunkt, also unterschiedlichen Schärfeebenen. So lässt sich die Schärfe gezielt über das Motiv verteilen, ohne dass man die Blende extrem schließen muss oder unnötig lange Belichtungszeiten riskiert.


    Anschließend habe ich die Serie in PTGui zusammengesetzt. Das Programm richtet die Einzelbilder sauber aus und überlagert sie. Am Ende entsteht ein Foto, das über die ganze Tiefe hinweg klar wirkt.

    Im PTGui-Screenshot sieht man, wie die fünf Aufnahmen übereinander ausgerichtet sind. So entsteht daraus das durchgehend scharfe Bild.


    Siehe Combine pictures with PTGui, Focus stacking

  • Märzschnee

    📅 March 13, 2026 · Fotografie · ⏱️ 1 min

    1/125s f/3,5 ISO 100/21° 16-50mm f/2,8 VR f=28mm/42mm


    1/125s f/3,5 ISO 100/21° 16-50mm f/2,8 VR f=50mm/75mm


    1/125s f/3,5 ISO 100/21° 16-50mm f/2,8 VR f=35mm/52mm


    1/125s f/3,5 ISO 100/21° 16-50mm f/2,8 VR f=35mm/52mm


    Lossless Minecraft Version


    1/125s f/3,5 ISO 100/21° 16-50mm f/2,8 VR f=30mm/45mm


    1/125s f/3,5 ISO 100/21° 16-50mm f/2,8 VR f=50mm/75mm


    1/100s f/6,3 ISO 100/21° 16-50mm f/2,8 VR f=23mm/34mm


    1/160s f/4 ISO 100/21° 16-50mm f/2,8 VR f=29mm/44mm


    Architektur im Kleinen: Katzentreppe
    1/60s f/6,3 ISO 100/21° 16-50mm f/2,8 VR f=20mm/30mm


    1/40s f/3,2 ISO 100/21° 16-50mm f/2,8 VR f=50mm/75mm


    1/160s f/2,8 ISO 100/21° 16-50mm f/2,8 VR f=50mm/75mm


    1/400s f/2,8 ISO 100/21° 16-50mm f/2,8 VR f=37mm/55mm


    1/160s f/4,5 ISO 100/21° 16-50mm f/2,8 VR f=26mm/39mm


    1/60s f/4,5 ISO 100/21° 16-50mm f/2,8 VR f=19mm/29mm


    1/60s f/4,5 ISO 100/21° 16-50mm f/2,8 VR f=50mm/75mm




    Diese Bilder sind Teil einer neuen Arbeitsweise.

  • Lossless Exposure & Contrast Adjustment in JPEG10

    📅 February 28, 2026 · Software, Fotografie · ⏱️ 6 min

    Lossless Tonal Adjustments in JPEG's DCT Domain: Exposure Compensation and Multi-Band Contrast

    Most JPEG workflows treat exposure (brightness) and contrast as inherently "lossy": decode pixels, apply curves, then re-encode. That approach works, but it always introduces an additional step of quantization error.

    In this github fork of the IJG JPEG-10 code, I added two options to jpegtran that operate directly on quantized DCT coefficients:

    • -exposure-comp EV
    • -contrast DC LOW MID HIGH

    Both are applied during transcoding, so they combine naturally with existing jpegtran operations such as rotation, flipping, cropping, marker copying, and progressive conversion.


    https://github.com/jurgen178/jpeg10
    Download Windows x64 binary: jpegtran.zip




    Quick Usage
    jpegtran [standard options] [-exposure-comp EV] [-contrast DC LOW MID HIGH] input.jpg output.jpg

    Examples:

    # Brighten by 1 stop
    jpegtran -copy all -exposure-comp 1 input.jpg output.jpg
    
    # Darken by 0.5 stops
    jpegtran -copy all -exposure-comp -0.5 input.jpg output.jpg
    
    # Contrast (uniform: DC=LOW=MID=HIGH)
    jpegtran -copy all -contrast -1   -1   -1   -1   input.jpg out-contrast-u-1.jpg
    jpegtran -copy all -contrast -0.5 -0.5 -0.5 -0.5 input.jpg out-contrast-u-0.5.jpg
    jpegtran -copy all -contrast  0.5  0.5  0.5  0.5 input.jpg out-contrast-u+0.5.jpg
    jpegtran -copy all -contrast  1    1    1    1   input.jpg out-contrast-u+1.jpg
    
    # Contrast (band-specific examples)
    jpegtran -copy all -contrast 0 0 0.6 0   input.jpg out-contrast-mid+0.6.jpg
    jpegtran -copy all -contrast 0 0 0 0.4   input.jpg out-contrast-high+0.4.jpg
    jpegtran -copy all -contrast 0 0.4 0 0   input.jpg out-contrast-low+0.4.jpg
    
    # Combine: rotate 90°, brighten 0.5 EV, and add uniform contrast +0.5
    jpegtran -copy all -rot 90 -exposure-comp 0.5 -contrast 0.5 0.5 0.5 0.5 input.jpg output.jpg

    Both switches accept fractional values. Practical ranges:

    Option    Practical range     Neutral
    -exposure-comp EV -3 … +3 0
    -contrast DC LOW MID HIGH -2 … +2 0


    Integrated into cPicture with live preview:




    Background: DCT Coefficient Basics

    A JPEG image is encoded as a grid of DCT blocks (with 8×8 Elements in size). Each block has one DC coefficient and 63 AC coefficients. But each MCU might have more than one block depending on the color subsampling.

    • DC[0] represents the (level-shifted) average sample value of the block. The relationship to pixel mean is:

      $$\mu = \frac{DC_\text{unquant}}{N} + \text{center}$$

      where $N$ is the DCT block size of 8 and $\text{center} = 2^{\text{precision}-1}$ (e.g. 128 for 8‑bit).

    • AC[1..N²−1] represent spatial frequency components (texture, edges, contrast).

    Both DC and AC are stored quantized: the actual stored integer is $\text{round}(\text{value} / Q_k)$, where $Q_k$ is the quantization step for coefficient $k$.




    -exposure-comp EV — Exposure Compensation


    Exposure compensation from -2EV to +2EV:


    Concept

    A photographic EV step corresponds to doubling (or halving) the amount of light. Applied in linear light:

    $$\text{gain} = 2^{EV}$$

    Because JPEG samples are gamma-coded (sRGB), pixel values cannot be multiplied directly. Instead:

    1. Estimate a representative level from the DC blocks.
    2. Compute the equivalent additive pixel-domain offset by applying the gain in linear light at that reference level.
    3. Translate the offset into a quantized DC delta.
    4. Add the delta to every DC coefficient.

    Only DC is modified. AC coefficients are not modified, so local contrast and texture are preserved.

    Reference Level — Log-Average

    A geometric mean (log-average) of all block mean levels is used as the exposure reference:

    $$\bar{L} = \exp\!\left(\frac{1}{B}\sum_{i=1}^{B} \ln(L_i + 1)\right) - 1$$

    where $L_i$ is the intensity mean of block $i$ (clamped to $[0, \text{MAX}]$) and $B$ is the total number of blocks.

    sRGB Linearisation

    The gain is applied in linear light:

    $$u_\text{ref} = \frac{\bar{L}}{\text{MAX}}$$

    $$u_\text{ref,lin} = f_\text{lin}(u_\text{ref})$$

    $$u_\text{new,lin} = \min(u_\text{ref,lin} \cdot \text{gain},\; 1.0)$$

    $$u_\text{new} = f_\text{sRGB}(u_\text{new,lin})$$

    The sRGB transfer functions used:

    $$f_\text{lin}(u) = \begin{cases} u / 12.92 & u \le 0.04045 \\ \left(\dfrac{u + 0.055}{1.055}\right)^{2.4} & u > 0.04045 \end{cases}$$

    $$f_\text{sRGB}(u) = \begin{cases} 12.92\,u & u \le 0.0031308 \\ 1.055\,u^{1/2.4} - 0.055 & u > 0.0031308 \end{cases}$$

    Pixel-Domain Offset → Quantized DC Delta

    $$\Delta_\text{samples} = (u_\text{new} - u_\text{ref}) \cdot \text{MAX}$$

    Clamped to available headroom/shadow room to limit clipping, then converted to a quantized DC delta:

    $$\Delta_{DC} = \text{round}\!\left(\frac{\Delta_\text{samples} \cdot N}{Q_0}\right)$$

    where $N$ is the DCT block size and $Q_0$ is the DC quantization step.

    Component Policy
    Color space Components adjusted
    YCbCr, BG_YCC, YCCK Luma only (component 0)
    RGB/BG_RGB + subtract-green transform Green/base only (component 1)
    CMYK, all others All components

    For CMYK and YCCK the delta is computed in an inverted intensity domain ($I = \text{MAX} - \text{sample}$) so that +EV brightens and −EV darkens.




    -contrast DC LOW MID HIGH — Contrast Adjustment


    Contrast from -1CV to +1CV:


    Concept

    This option provides four separate controls (all in stops):

    • DC controls the DC coefficient (block mean)
    • LOW, MID, HIGH control the AC coefficients in frequency order

    All controls are interpreted as log2 gains (stops). For a value $x$, the gain is:

    $$g(x) = 2^{x}$$

    So +1 doubles, -1 halves.

    DC

    DC is scaled by:

    $$g_\mathrm{DC} = 2^{DC}$$

    and applied as:

    $$DC' = \mathrm{clamp}(\mathrm{round}(g_\mathrm{DC} \cdot DC))$$

    AC (low/mid/high weighting)

    AC coefficients are processed in zigzag order (the JPEG natural order). Let $z$ be the AC position with $z = 1 \ldots A$, where $A$ is the number of AC coefficients.

    Define a normalized position:

    $$t = \begin{cases} \dfrac{z-1}{A-1} & A > 1 \\ 0 & A = 1 \end{cases}$$

    Triangular weights:

    • low weight fades out from low frequencies

    $$w_\mathrm{low} = \max(0, 1 - 2t)$$

    • mid weight peaks in the middle

    $$w_\mathrm{mid} = 1 - |2t - 1|$$

    • high weight fades in toward high frequencies

    $$w_\mathrm{high} = \max(0, 2t - 1)$$

    Per-coefficient exponent and gain:

    $$v(z) = LOW\cdot w_\mathrm{low} + MID\cdot w_\mathrm{mid} + HIGH\cdot w_\mathrm{high}$$

    $$g(z) = 2^{v(z)}$$

    Applied to each AC coefficient:

    $$AC'[z] = \mathrm{clamp}(\mathrm{round}(g(z)\cdot AC[z]))$$

    If DC = LOW = MID = HIGH = X, then all coefficients are scaled by the same gain $2^X$ (uniform contrast adjustment).

    Component Policy

    Same as -exposure-comp:

    • YCbCr/BG_YCC/YCCK: luma only
    • RGB subtract-green: base/green only
    • otherwise: all components



    Ordering and Composition

    Both -exposure-comp and -contrast are applied as a post step after any geometric transform (-rot, -flip, -crop, …). The tonal operations work on the final output coefficient arrays, so the order of switches on the command line does not matter.



    Implementation notes
    • Core implementation:
      • transupp.c: do_exposure_comp() and do_contrast()
      • transupp.h: adds new fields to jpeg_transform_info
    • CLI parsing:
      • jpegtran.c
    • Feature flags and parameters are stored in jpeg_transform_info in transupp.h



    Summary
    • -exposure-comp EV shifts brightness by changing only DC coefficients, with EV evaluated in linear light (sRGB transfer) at a log-average reference.
    • -contrast DC LOW MID HIGH scales DC and AC coefficients, with AC gains varying smoothly over frequency order using low/mid/high controls.
    • Both run in the DCT domain and integrate naturally into the lossless-transformation workflow of jpegtran.

    Example pictures
Page 1 of 11 Older Posts →
ABOUT

Jürgen E
Principal Engineer, Villager, and the creative mind behind lots of projects:
Windows Photo Explorer (cpicture-blog), Android apps AI code rpn calculator and Stockroom, vrlight, 3DRoundview, BitBlog and my github


Blog-Overview Chronological

CATEGORIES

Auto • Electronics • Fotografie • Motorrad • Paintings • Panorama • Software • Querbeet


Built with BitBlog!