scaling and resizing of image now works reasonably well.