API Documentation > CorelDRAW > 2025-v26 > Bitmap > IVGBitmap
Bitmap.Resample method
Resamples the bitmap
Syntax:
Sub Resample(Optional ByVal Width As Long = 0, Optional ByVal Height As Long = 0, Optional ByVal AntiAlias As Boolean = True, Optional ByVal ResolutionX As Double = 0, Optional ByVal ResolutionY As Double = 0)
Parameters:
Name Type Description
Width
Long
Specifies the width.
Height
Long
Specifies the height.
AntiAlias
Boolean
Specifies whether to apply anit-aliasing.
ResolutionX
Double
Specifies the horizontal resolution.
ResolutionY
Double
Specifies the vertical resolution.
Remarks:
The Resample method resizes a bitmap.
Examples:
The following VBA example resizes all bitmaps on the active page. All bitmaps fit in a 150 × 150 pixel frame and maintain their original aspect ratio.
Sub Test()
Dim s As Shape
Dim Width As Double
Dim Height As Double
Dim AspectRatio As Double
Width = 150
Height = 150
For Each s In ActivePage.Shapes
  If s.Type = cdrBitmapShape Then

 'so if thewidth is greater than theheight

 If s.Bitmap.SizeWidth > s.Bitmap.SizeHeight Then


'the aspect ratio is Height divided by Width


AspectRatio = s.Bitmap.SizeHeight / s.Bitmap.SizeWidth


Height = AspectRatio * Width


'height is greater than width, so

 ElseIf s.Bitmap.SizeHeight > s.Bitmap.SizeWidth Then


'the aspect ratio is Width divided by Height


AspectRatio = s.Bitmap.SizeWidth / s.Bitmap.SizeHeight


Width = AspectRatio * Height

 End If

 s.Bitmap.Resample CLng(Width), CLng(Height)
  End If
Next s 
End Sub