ResizeImage

Allows resizing of an image to a specified size.

This method performs functionality similar to CreateThumbNail() which optimizes Thumbnail sizes and compression levels on the fly. This function provides more control and produces higher quality images, but is slower.

ResizeImage(lcSource, lcTarget, lnWidth, lnHeight, lnCompression)

Return Value

.T. or .F.

Parameters

lcSource
Source file to resize.

lcTarget
Target file where to store the resized file.

lnWidth
The new width of the file.

lnHeight
The new height of the file.

lnCompression
The JPG Compression level: 0 for no compression 100 compression. -1 uses the system default (fairly high compression). Depending on image size 85 is a good middle of the road value, use higher for cleaner images, lower for more pixellation.

Remarks

Uses wwImaging.dll in the .\tools directory.

The height and width are calculated by taking the longer side and reducing it to the specified width or height value, then figuring out the aspect ratio on the other dimension. This means image aspect ratios are maintained and images are not sized to the exact dimensions specified, but only match on the longer side. Images are never distorted or stretched.

This function supports the following image formats:

  • gif
  • jpg
  • png
  • tiff
  • bmp

This function requires wwImaging.dll and uses GDI+ which is available with XP/.NET Server by default and as separate installs on all other platforms. The latest versions of Internet Explorer (6.0), the Windows Media player and the .NET Platform also install GDI+.

Note this is a function not a method of the wwAPI class. This function is simply stored in the wwAPI.prg file.

GDI+ is downloadable from: http://www.microsoft.com/downloads/release.asp?releaseid=32738


See also:

Class wwAPI

© West Wind Technologies, 1996-2024 • Updated: 10/21/21
Comment or report problem with topic