func Distance(ctx context.Context, fileName1, fileName2 string) (int, error) {
	ch := loader.ImagesAsync(ctx, fileName1, fileName2)
	r1 := <-ch
	if r1.Err != nil {
		return 0, r1.Err
	}
	r2 := <-ch
	if r2.Err != nil {
		return 0, r2.Err
	}
	r, err := DistancePure(ctx, r1.Img, r2.Img)
	if err != nil {
		return 0, err
	}
	return r, nil
}
Distance calculate average difference between 2 images
package avg
import (
	"context"
	"fmt"
	"image"
	"math"
	"github.com/AskAlexSharov/imgdiff/loader"
)