Modified to require imagefile and size as parameters