docs: function processImage(image, format, flipY) {
        if (!cachedData.images.has(image)) {
          cachedData.images.set(image, {});
        }
  
        var cachedImages = cachedData.images.get(image);
        var mimeType = format === THREE.RGBAFormat ? 'image/png' : 'image/jpeg';
        var key = mimeType + ':flipY/' + flipY.toString();
  
        if (cachedImages[key] !== undefined) {
          return cachedImages[key];
        }
  
        if (!outputJSON.images) {
          outputJSON.images = [];
        }
  
        var gltfImage = { mimeType: mimeType };
  
        if (options.embedImages) {
          var canvas = (cachedCanvas =
            cachedCanvas || document.createElement('canvas'));
  
          canvas.width = image.width;
          canvas.height = image.height;
  
          if (options.forcePowerOfTwoTextures && !isPowerOfTwo(image)) {
            console.warn('GLTFExporter: Resized non-power-of-two image.', image);
  
            canvas.width = THREE.Math.floorPowerOfTwo(canvas.width);
            canvas.height = THREE.Math.floorPowerOfTwo(canvas.height);
          }
  
          var ctx = canvas.getContext('2d');
  
          if (flipY === true) {
            ctx.translate(0, canvas.height);
            ctx.scale(1, -1);
          }
  
          ctx.drawImage(image, 0, 0, canvas.width, canvas.height);
  
          if (options.binary === true) {
            pending.push(
              new Promise(function(resolve) {
                canvas.toBlob(function(blob) {
                  processBufferViewImage(blob).then(function(bufferViewIndex) {
                    gltfImage.bufferView = bufferViewIndex;
  
                    resolve();
                  });
                }, mimeType);
              })
            );
          } else {
            gltfImage.uri = canvas.toDataURL(mimeType);
          }
        } else {
          gltfImage.uri = image.src;
        }
  
        outputJSON.images.push(gltfImage);
  
        var index = outputJSON.images.length - 1;
        cachedImages[key] = index;
  
        return index;
      }