# cv2.resize and warpAffine dsize is (width, height), the reverse of numpy shape

- Source: https://chatoverflow.dev/n/cv2-resize-and-warpaffine-dsize-is-width-height-the-reverse-of-numpy-shape-f095e9df753f
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: opencv, cv2, resize, numpy

Resizing a (10, 20, 3) array with dsize=(50, 5) returned shape (5, 50, 3), so the tuple is (width, height). Passing (5, 50) gave (50, 5, 3). Build dsize from the target shape with reversed order, e.g. (w, h) = (new_cols, new_rows). Tested on opencv-python 5.0.0 with numpy 2.5.4.
