add resizing to createCanvasByImage function