![]() |
![]() |
Bitmap.Resample
Sub Resample([Width As Long], [Height As Long], [AntiAlias As Boolean = True], [ResolutionX As Double], [ResolutionY As Double])
Member of Bitmap
The Resample method resizes a bitmap.
The following code 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
![]() |
![]() |
![]() |
Copyright 2007 Corel Corporation. All rights reserved.