async function imageTransform(pth, o) {
  var fmt = path.extname(pth).substring(1);
  var dst = tempy.file({extension: 'jpg'});
  var img = await Jimp.read(pth);
  var w0 = img.bitmap.width, h0 = img.bitmap.height;
  if(o.resizeX || o.resizeY) img.resize(o.resizeX||Jimp.AUTO, o.resizeY||Jimp.AUTO);
  if(o.fitX && o.fitY && (w0>o.fitX || h0>o.fitY)) img.scaleToFit(o.fitX, o.fitY);
  var w1 = img.bitmap.width, h1 = img.bitmap.height;
  if(o.log) console.log('-imageTransform:', `${fmt} ${w0}x${h0} -> jpg ${w1}x${h1}`);
  await img.writeAsync(dst);
  return dst;
}
// Transform image to proper size.
Transform image to proper size.
Transform image to proper size .
async function imageTransform(pth, o) {
  var fmt = path.extname(pth).substring(1);
  var dst = tempy.file({extension: 'jpg'});
  var img = await Jimp.read(pth);
  var w0 = img.bitmap.width, h0 = img.bitmap.height;
  if(o.resizeX || o.resizeY) img.resize(o.resizeX||Jimp.AUTO, o.resizeY||Jimp.AUTO);
  if(o.fitX && o.fitY && (w0>o.fitX || h0>o.fitY)) img.scaleToFit(o.fitX, o.fitY);
  var w1 = img.bitmap.width, h1 = img.bitmap.height;
  if(o.log) console.log('-imageTransform:', `${fmt} ${w0}x${h0} -> jpg ${w1}x${h1}`);
  await img.writeAsync(dst);
  return dst;
}
async function imageTransform ( pth , o ) { var fmt = path . extname ( pth ) . substring ( 1 ) ; var dst = tempy . file ( { extension : 'jpg' } ) ; var img = await Jimp . read ( pth ) ; var w0 = img . bitmap . width , h0 = img . bitmap . height ; if ( o . resizeX || o . resizeY ) img . resize ( o . resizeX || Jimp . AUTO , o . resizeY || Jimp . AUTO ) ; if ( o . fitX && o . fitY && ( w0 > o . fitX || h0 > o . fitY ) ) img . scaleToFit ( o . fitX , o . fitY ) ; var w1 = img . bitmap . width , h1 = img . bitmap . height ; if ( o . log ) console . log ( '-imageTransform:' , ` ${ fmt } ${ w0 } ${ h0 } ${ w1 } ${ h1 } ` ) ; await img . writeAsync ( dst ) ; return dst ; }
Transform image to proper size.
Transform image to proper size .