Implementation of Daryl's changes

Re-work to resizeImage function.