resizer take margins into consideration