PNGResample (resize a PNG)
ts
function PNGResample(
imgFile: string,
maxWidth: number,
maxHeight: number
): boolean;Resizes the specified PNG image (imgFile) using the Lanczos3 resampling method for optimal detail.
- Maintains the original aspect ratio.
- Chooses the smaller of
maxWidthormaxHeight(in pixels) as the limiting dimension. Set either to 0 to ignore that constraint.
Returns true if the image was resized successfully, or false if an error occurred.
Example
ts
PNGResample('./self_portrait.png', 800, 600);