If you want to resize an image it is a good idea to keep the proportions.
This is what the function does
double ImageResize(DWORD __dwOriginalWidth,DWORD __dwOriginalHeight,DWORD __dwExpectedWidth,DWORD __dwExpectedHeight,DWORD *__lpdwNewWidth,DWORD *__lpdwNewHeight)
{
register DWORD _dwWidth ;
register DWORD _dwHeight ;
alignas(double) double dRatio ;
if(__dwOriginalWidth > __dwOriginalHeight)
{
dRatio = (double) __dwOriginalHeight / (double) __dwOriginalWidth ;
_dwWidth = __dwExpectedWidth ;
_dwHeight = (DWORD) ((double) _dwWidth * dRatio) ;
if(_dwHeight > __dwExpectedHeight)
{
_dwHeight = __dwExpectedHeight ;
_dwWidth = (DWORD) (((double) _dwHeight) / dRatio) ;
}
*__lpdwNewWidth = _dwWidth ;
*__lpdwNewHeight = _dwHeight ;
return (dRatio) ;
}
dRatio = (double) __dwOriginalWidth / (double) __dwOriginalHeight ;
_dwHeight = __dwExpectedHeight ;
_dwWidth = (DWORD) (((double) _dwHeight) * dRatio) ;
if(_dwWidth > __dwExpectedWidth)
{
_dwWidth = __dwExpectedWidth ;
_dwHeight = (DWORD) (((double) _dwWidth) / dRatio) ;
}
*__lpdwNewWidth = _dwWidth ;
*__lpdwNewHeight = _dwHeight ;
return (dRatio) ;
}