change to precalculate image size...hopefully this will speed things up