PNGResample (resize a PNG)

function PNGResample(
  imgFile:   string,
  maxWidth:  number,
  maxHeight: number
): boolean

The PNGResample function resizes a PNG image (imgFile) using the Lanczos3 resampling method to keep the best possible level of detail.

This function also retains the original image’s aspect-ratio, and chooses between maxWidth and maxHeight (in pixels) whichever one would result in a smaller image. If you wish one of these two parameters to be ignored, simply set it to 0 (zero).

This function returns true if the image was resized successfully, or false if errors occurred.

Example:

{
  PNGResample('./self_portrait.png', 800, 600);
}