Validate image parameters. Fixes #117