function createLoader(options) {
  const load = options.load ? options.load : decode;
  const projection = getProjection(options.projection || 'EPSG:3857');
  const ratio = options.ratio ?? 1.5;
  const crossOrigin = options.crossOrigin ?? null;

  return function (extent, resolution, pixelRatio) {
    pixelRatio = options.hidpi ? pixelRatio : 1;

    const params = {
      'F': 'image',
      'FORMAT': 'PNG32',
      'TRANSPARENT': true,
    };
    Object.assign(params, options.params);

    extent = getRequestExtent(extent, resolution, pixelRatio, ratio);

    const src = getRequestUrl(
      options.url,
      extent,
      resolution,
      pixelRatio,
      projection,
      params,
    );

    const image = new Image();
    image.crossOrigin = crossOrigin;

    return load(image, src).then((image) => {
      // Update resolution, because the server may return a smaller size than requested
      const resolution = (getWidth(extent) / image.width) * pixelRatio;
      return {image, extent, resolution, pixelRatio};
    });
  };
}
Creates a loader for ArcGIS Rest images.
@param {LoaderOptions} options Image ArcGIS Rest Options.
@return {import('../Image.js').ImageObjectPromiseLoader} ArcGIS Rest image.
@api