sws_scale YUV --> RGB distorted image

别来无恙 提交于 2019-11-29 02:08:24

When you make a bitmap image, the width of image MUST be multiple of 4.

So you have to change width like 480, 484, 488, 492 ...

Here is method to change to multiple of 4

#define WIDTHBYTES(bits) (((bits) + 31) / 32 * 4)

void main()
{
    BITMAPFILEHEADER bmFileHeader;
    BITMAPINFOHEADER bmInfoHeader;

    // load image
    // ...

    // when you use the method, put parameter like this.
    int tempWidth = WIDTHBYTES(width * bmInfoHeader.biBitCount);
}

I hope you solve the problem.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!