MCPcopy Create free account
hub / github.com/imgproxy/imgproxy / NewImageHash

Function NewImageHash

testutil/image_hash.go:38–45  ·  view source on GitHub ↗

NewImageHash creates a new hash from an image reader

(r io.Reader, hashType ImageHashType)

Source from the content-addressed store, hash-verified

36
37// NewImageHash creates a new hash from an image reader
38func NewImageHash(r io.Reader, hashType ImageHashType) (*ImageHash, error) {
39 data, err := io.ReadAll(r)
40 if err != nil {
41 return nil, fmt.Errorf("failed to read image data: %w", err)
42 }
43
44 return NewImageHashFromBytes(data, hashType)
45}
46
47// NewImageHashFromPath loads an image from a file path and calculates its hash
48func NewImageHashFromPath(path string, hashType ImageHashType) (*ImageHash, error) {

Callers 5

calcHashMethod · 0.92
computeDistMethod · 0.92
TestQualitySettingsMethod · 0.92
TestSvgSuiteMethod · 0.92
processImgMethod · 0.92

Calls 2

NewImageHashFromBytesFunction · 0.85
ErrorfMethod · 0.80

Tested by 5

calcHashMethod · 0.74
computeDistMethod · 0.74
TestQualitySettingsMethod · 0.74
TestSvgSuiteMethod · 0.74
processImgMethod · 0.74