handle error and invoke as `fn(err, img)` instead