consolidate image scaling code into single class.
(possible) fix for Issue 320: pt numbers does not appear correctly in UI.
merge from lodici