Automatic Proportional resize with constraints