JPEGResample (resize a JPG)
ts
function JPEGResample(
imgFile: string,
maxWidth: number,
maxHeight: number,
quality: number
): boolean;Resizes the specified JPEG 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. qualityis a value from 1 to 100 (higher means better quality, less compression).
Returns true if the image was resized successfully, or false if an error occurred.
Example
ts
JPEGResample('./self_portrait.jpg', 800, 600, 90);