#! /bin/bash
# Last edited on 2024-04-01 16:24:09 by stolfi

# Reads two images "${name}-blur1.png" (image blurred with radius 1 or 0)
# and and "${name}-blurf.png" (image blurred with a bigger radius) and 
# subtracts them producing "${name}-sharp.png", hopefully sharper.

name="$1"; shift

convert ${name}-blur1.png .a-blur1.ppm
convert ${name}-blurf.png .a-blurf.ppm
pnmxarith -subtract -offset 0.5 -scale 1.0 .a-blur1.ppm .a-blurf.ppm > .a-sharp.ppm
convert .a-sharp.ppm ${name}-sharp.png
display -title '%f' ${name}{-sharp,-blur1,-blurf}.png

