function slice(squareImage, left, width) {
  const CANVAS = document.createElement("canvas");
  const CTX = CANVAS.getContext("2d");

  CANVAS.width = Math.max(width, 1);
  CANVAS.height = Math.max(squareImage.naturalHeight, 1);

  CTX.drawImage(
    squareImage,
    left,
    0,
    CANVAS.width,
    CANVAS.height,
    0,
    0,
    CANVAS.width,
    CANVAS.height
  );

  // return CANVAS.toDataURL("image/png");
  return CANVAS.toDataURL("image/jpeg");
}
/**
  * @desc Creates a slice of an image
  * @param image image- input image
  * @param leftCM int- start of left edge of slice
  * @param widthCM int- width of slice
*/
@desc Creates a slice of an image
@param image image- input image
@param leftCM int- start of left edge of slice
@param widthCM int- width of slice
@desc Creates a slice of an image @param image image - input image @param leftCM int - start of left edge of slice @param widthCM int - width of slice
function slice(squareImage, left, width) {
  const CANVAS = document.createElement("canvas");
  const CTX = CANVAS.getContext("2d");
  CANVAS.width = Math.max(width, 1);
  CANVAS.height = Math.max(squareImage.naturalHeight, 1);
  CTX.drawImage(
    squareImage,
    left,
    0,
    CANVAS.width,
    CANVAS.height,
    0,
    0,
    CANVAS.width,
    CANVAS.height
  );
  return CANVAS.toDataURL("image/jpeg");
}
function slice ( squareImage , left , width ) { const CANVAS = document . createElement ( "canvas" ) ; const CTX = CANVAS . getContext ( "2d" ) ; CANVAS . width = Math . max ( width , 1 ) ; CANVAS . height = Math . max ( squareImage . naturalHeight , 1 ) ; CTX . drawImage ( squareImage , left , 0 , CANVAS . width , CANVAS . height , 0 , 0 , CANVAS . width , CANVAS . height ) ; return CANVAS . toDataURL ( "image/jpeg" ) ; }
@desc Creates a slice of an image
 @param image image- input image
 @param leftCM int- start of left edge of slice
 @param widthCM int- width of slice
@desc Creates a slice of an image @param image image - input image @param leftCM int - start of left edge of slice @param widthCM int - width of slice
// return CANVAS.toDataURL("image/png");
