Fix image scaling problem (SCI-1644)

Fix to http://jira.diamond.ac.uk/browse/SCI-1644
Change exception type