added optim to all image scaling