Calculate the new width and height (if you have scaling factors)
float newWidth = horizontalScalingFactor * (float) originalBitmap->GetWidth(); float newHeight = verticalScalingFactor * (float) originalBitmap->GetHeight();
or scaling factors if new sizes are known
float horizontalScalingFactor = (float) newWidth / (float) originalBitmap->GetWidth(); float verticalScalingFactor = (float) newHeight / (float) originalBitmap->GetHeight();
Create a new blank raster map with enough space for a scaled image
Image* img = new Bitmap((int) newWidth, (int) newHeight);
Create new graphics for drawing on the created bitmap:
Graphics g(img);
Apply scale transformation to the graphic and draw an image
g.ScaleTransform(horizontalScalingFactor, verticalScalingFactor); g.DrawImage(originalBitmap, 0, 0);
img now another bitmap with a scaled version of the original image.
source share