added support for image scaling