Stripping HDR from iPhone images and videos
Apple has gone all in on HDR content from iPhones, which makes them appear bright but also pose a nightmare for embedding on websites. Macs and iPhones render the HDR images with "super whites", which successfully makes them pop, but at the cost of dimming the rest of the screen (you can see a technical example of this in a Github repo or a practical example in the article images for Digital Divinity).
But how do you remove it? I've been using commands from my previous posts: the Tic Tac post for images and the combination lock post for videos but wanted one place to put them. Just paste into Terminal, drag in the image/video, and it will convert it in place.
sh -c 'sips -s format jpeg -s formatOptions 90 --out "${1%.*}.jpg" "$1"' _
sh -c 'ffmpeg -i "$1" -c:v h264_videotoolbox -maxrate 2600K -bufsize 2600K -vf "zscale=t=linear:npl=100,format=gbrpf32le,zscale=p=bt709,tonemap=tonemap=hable:desat=0,zscale=t=bt709:m=bt709:r=tv,scale=trunc(iw/2):trunc(ih/2),format=yuv420p" -c:a aac "${1%.*}.mp4"' _