Update generateImage.js

Won't unnecessarily scale images which are too small. Also will use the scaled down size in calculations.