draft of auto image scaling