Thursday, 15 February 2024

Halide Linux Digital Workflow with RawTherapee

Phone cameras have steadily been improving over the last decade but one issue for serious photographers has been the ability to obtain full control of their camera settings and then the ability to obtain a RAW image for imrproved processing.



The recent iPhone Pro Max models have Apple ProRAW and can be enabled by default for the iOS camera, but if you have the non-Pro Max models you will need specific camera apps to allow you to make the most of the camera sensor.

The Halide MkII app has been a very good camera app that gives us RAW images - coupled with the OpenSource RAW editor RawTherapee we have, in my opinion, the basis for acceptable iPhone digital workflow.

RawTherapee

RawTherapee is a RAW processor and like many RAW processors generates sidecar files containing the edits associated with each file and uses profile to control how the initial/first time seen RAW file rendering is performed. There exits 2 types of profile: auto matched tone curve (AMTC) and standard film curve with their variations for low/med/high ISO equivalants - the former is noted as to automatically adjust [settings] to match the look of the embedded JPEG thumbnail which is a good starting point.
Halide/iOS WB corrected only with AMTC only with before/after minor adjustments
For Halide RAW files even with low ISO, the images are rendered fairly flat even with AMTC - I find that the Exposure -> Saturation needs to be set in the 15-30 range to provide a good basis for processing. For comparison against, Nikon NEFs with AMTC require much less saturation boosts to get close to OoC jpeg rendering.
Nikon default rendering with AMTC adjustment only

Noise

Given the iPhone sensor size, anything above base ISO seems to have noticable noise artifacts but these can be cleaned up using the LMMSE or IGB Demosaicing algorithms and some minor noise reduction.
Halide RAW ISO200, demosaic algorithm LMMSE - minor cleanup top: see noise on PCB on right

Key Processing

The key processing elements that I find are adjusted on each image and are the basis for most of my processing profiles, starting with the ATMC bundle profile:
  • Exposure
    • Saturation
    • Shadows/Highlights - Highlights
  • Detail
    • Sharpening
    • Local Contrast - Darkness/Lightness levels: 30-40
    • Noise Reduction - Luminance: 30-70, Detail Recovery: 60-100
  • Raw
    • Demosaicing - AMaZE (low ISO), LMMSE or IGV (med-high ISO)/li>
    • Capture Sharpening - Contrast Threshold
This can be saved as your own profile and selected as appropriate.

Dynamic Profiles

Obviously having to add all adjustments to each RAW file is suboptimal even with saved profiles. However, RawTherapee provides dynamic profiles that applies specific profiles based on specific file metadata, such as camera model or lens. The default profile selection is controlled by: Settings -> Image Processing -> For raw photos -> (Dynamic):
Ensure that the auto matched tone curve button is reselected on each RAW image

RAW generated images

Once the output files (jpeg etc) are generated, you may want to re-embed the processed files into the RAW files via exiftool. A useful script to to update a set of corresponding jpg and dng: for i in *.jpg; do dng-preview-upd "${i%.jpg}.DNG"; done
cat > dng-preview-upd << EOF #!/bin/bash ARG0=$(basename $0) function usage() { echo "usage: $ARG0 <dng> <jpg preview>" } [ $# -ne 2 -a $# -ne 1 ] && usage && exit 1 EXIFTOOL=${DNG_PREVIEW_UPDATE_EXIFTOOL:-/usr/local/Image-ExifTool-12.70/exiftool} [ ! -x $EXIFTOOL ] && echo "$ARG0: no such executable '$EXIFTOOL'" && exit 1 PREVIEW=$2 DNG=$1 [ ! -f "$DNG" ] && echo "$ARG0: no such file '$DNG'" && exit 1 MIME_TYPE=xdg-mime which ${MIME_TYPE} 2>&1 >/dev/null if [ $? -eq 0 ]; then WHAT_TYPE="$(${MIME_TYPE} query filetype "${DNG}")" if [ "$WHAT_TYPE" != "image/x-adobe-dng" ]; then echo "$ARG0: invalid dng type - ${WHAT_TYPE}: $DNG" exit 1 fi fi # 12.70 and below cannot add a preview image if one doesnt exist HAS_PREVIEW=$($EXIFTOOL -PreviewImageLength "$DNG") [ -z "$HAS_PREVIEW" ] && echo "$ARG0: no current preview image, unable to process '$DNG' - try 'dnglab convert -d --dng-preview true INPUT.dng OUTPUT.dng' to rebuild" && exit 1 if [ -z "${PREVIEW}" ]; then PREVIEW="${DNG%.*}.jpg" if [ ! -f "$PREVIEW" ]; then PREVIEW="${DNG%.*}.JPG" if [ ! -f "$PREVIEW" ]; then usage exit 2; fi fi fi if [ "$(identify -quiet -format "%m\n" "${PREVIEW}")" != "JPEG" ]; then echo "$ARG0: preview, ${PREVIEW}, is not JPEG" exit 2 fi DPU_VERBOSE="-q" if [ ! -z "$DNG_PREVIEW_UPDATE_VERBOSE" ]; then DPU_VERBOSE="-v2" fi DPU_OVERWRITE_ORIG="-overwrite_original" if [ ! -z "$DNG_PREVIEW_UPDATE_KEEP" ]; then DPU_OVERWRITE_ORIG="" fi # checks for broken DNGs from halide that put preview images in a different place IFD_TAG=ifd0 ${EXIFTOOL} -if '$SubIFD1:SubFileType eq 1' -b -w1 ${DNG}; if [ $? -eq 0 ]; then IFD_TAG=subifd1 fi exec $EXIFTOOL \ ${DPU_OVERWRITE_ORIG} ${DPU_VERBOSE} \ "-previewImage<=${PREVIEW}" \ -tagsfromfile "${PREVIEW}" \ "-${IFD_TAG}:imagewidth<imagewidth" "-${IFD_TAG}:imageheight<imageheight" "-${IFD_TAG}:rowsperstrip<imageheight" \ -ModifyDate="$(date -u +"%Y:%m:%d %H:%M:%S")" \ "${DNG}" EOF

No comments:

Post a Comment