protect against negative image dimensions - closes #1927