update matimage to support scalefactor