Created
November 20, 2025 17:20
-
-
Save sturmen/0b6d5d73bd4da0c7aa6a6a1aa06e612c to your computer and use it in GitHub Desktop.
ZSH script to apply anamorphic desqueeze to still photos
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Change to the directory where the script is located | |
| cd "$(dirname "$0")" | |
| # Clear the terminal screen | |
| clear | |
| # Tool Intro Text | |
| echo -e "\033[1mAnamorphic DNG EXIF DeSqueeze for Exiftool - written by Rupert Warries for MAC OS\033[0m\n\n\033[1m------------ \033[0m\n\nThis Tool will rewrite each DNG's EXIF data to allow Lightroom to render each image de-squeezed in DEVELOP module (library will still show squeezed image - any program that reads the pixel ratio in EXIF will also work)." | |
| echo -e "\n\nUSAGE INSTRUCTION :\n1. Place this script from inside the folder containing the DNG images for processing\n2. Drag tool into a terminal window to run and follow the prompts\n3. DNG filenames must contain no spaces - run the tool by dragging into a terminal window and following the prompts\n4. an installation of Exiftool must be present for this script to operate\n\n\033[1m------------ \033[0m" | |
| # Show the directory and ask for confirmation | |
| echo -e "\nAll DNG files present will be de-squeezed in the following directory:\n$(pwd)\n" | |
| read -p "Do you want to continue? (Y/N): " confirm | |
| # Check user input | |
| if [[ $confirm != [Yy] ]]; then | |
| echo "Processing cancelled." | |
| exit 1 | |
| fi | |
| #Ask for Squeeze factor and Loop until a valid number is entered | |
| while true; do | |
| read -p "Enter the lens squeeze factor (e.g. 1.0, 1.33, 1.5, 2.0): " squeeze_factor | |
| # Check if the input is a valid number | |
| if [[ $squeeze_factor =~ ^[0-9]+(\.[0-9]+)?$ ]]; then | |
| break | |
| else | |
| echo "Desqueeze must be a number" | |
| fi | |
| done | |
| # Process files in the current directory | |
| for file in $(find . -maxdepth 1 -type f \( -iname "*.DNG" -o -iname "*.dng" \)); do | |
| exiftool -DefaultScale="$squeeze_factor 1.0" -overwrite_original "$file" | |
| done | |
| # Print confirmation message | |
| echo -e "\n\033[1mProcessing complete\033[0m\nDNG's EXIF rewritten with with a $squeeze_factor Squeeze factor\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment