variable parsing in watermark path

Also, fixed some segfaults when watermark is not found or not an PNG
image.