Added resizing with keeping aspect ratio when dimension is 0.