# Cv::resize height and width

**URL:** https://forum.opencv.org/t/cv-resize-height-and-width/19749
**Category:** C++
**Created:** [January 13, 2025, 4:15am UTC](https://forum.opencv.org/t/cv-resize-height-and-width/19749 "2025-01-13T04:15:57Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![UnlimitedR](https://avatars.discourse-cdn.com/v4/letter/u/e9bcb4/32.png) [@UnlimitedR](https://forum.opencv.org/u/UnlimitedR)
#### Post date: [January 13, 2025, 4:15am UTC](https://forum.opencv.org/t/cv-resize-height-and-width/19749/1 "2025-01-13T04:15:57Z")

</div>

```cpp
    // Resize image to target size
    cv::Mat resized_img;
    cv::resize(color_img, resized_img, cv::Size(800, 1100));

    std::cout << resized_img.rows << " " << resized_img.cols << " " << resized_img.channels() << std::endl;

```

I have some resized codes as above, I expected the output to be 800 1100 3 but it is 1100 800 3.

I asked gpt and it says

> In OpenCV, always remember that `cv::Size(width, height)` specifies the dimensions in **width** (columns) first and **height** (rows) second. This convention is different from some other libraries or frameworks where height comes before width.

it is stupid, why would I want this from resize?

---

<div class="post-metadata">

### Author: ![crackwitz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/crackwitz/32/14_2.png) [@crackwitz](https://forum.opencv.org/u/crackwitz)
#### Post date: [January 13, 2025, 9:46am UTC](https://forum.opencv.org/t/cv-resize-height-and-width/19749/2 "2025-01-13T09:46:09Z")

</div>

give it the right Size expression and then it’ll do what you want.
