imgfprint 0.2.0

High-performance, deterministic image fingerprinting library
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
# imgfprint Usage Guide

> Complete API reference and examples for high-performance image fingerprinting

---

## Table of Contents

- [Quick Start]#quick-start
- [Core API]#core-api
  - [ImageFingerprinter]#imagefingerprinter
    - [Multi-Algorithm Mode (Default)]#multi-algorithm-mode-default
    - [Single Algorithm Mode]#single-algorithm-mode
  - [FingerprinterContext]#fingerprintercontext
  - [ImageFingerprint]#imagefingerprint
  - [MultiHashFingerprint]#multihashfingerprint
  - [Similarity]#similarity
- [Advanced Usage]#advanced-usage
  - [Batch Processing]#batch-processing
  - [Semantic Embeddings]#semantic-embeddings
- [Error Handling]#error-handling
- [Performance Tips]#performance-tips
- [Feature Flags]#feature-flags

---

## Quick Start

Add the dependency to your `Cargo.toml`:

```toml
[dependencies]
imgfprint = "0.1.2"
```

### Basic Example (Multi-Algorithm)

Compare two images using both PHash and DHash for best accuracy:

```rust
use imgfprint::ImageFingerprinter;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Load images
    let img1 = std::fs::read("photo1.jpg")?;
    let img2 = std::fs::read("photo2.jpg")?;
    
    // Generate fingerprints (computes both PHash and DHash in parallel)
    let fp1 = ImageFingerprinter::fingerprint(&img1)?;
    let fp2 = ImageFingerprinter::fingerprint(&img2)?;
    
    // Compare using weighted combination (60% PHash, 40% DHash)
    let sim = fp1.compare(&fp2);
    
    println!("Similarity: {:.2}", sim.score);
    println!("Exact match: {}", sim.exact_match);
    
    if sim.score > 0.8 {
        println!("Images are perceptually similar");
    }
    
    Ok(())
}
```

### Single Algorithm Example

For better performance when you only need one algorithm:

```rust
use imgfprint::{ImageFingerprinter, HashAlgorithm};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let img1 = std::fs::read("photo1.jpg")?;
    let img2 = std::fs::read("photo2.jpg")?;
    
    // Use only DHash (faster than multi-algorithm)
    let fp1 = ImageFingerprinter::fingerprint_with(&img1, HashAlgorithm::DHash)?;
    let fp2 = ImageFingerprinter::fingerprint_with(&img2, HashAlgorithm::DHash)?;
    
    let sim = ImageFingerprinter::compare(&fp1, &fp2);
    
    println!("Similarity: {:.2}", sim.score);
    
    Ok(())
}
```

---

## Core API

### ImageFingerprinter

Static methods for computing and comparing fingerprints. The primary entry point for most use cases.

#### Multi-Algorithm Mode (Default)

##### `fingerprint()`

```rust
pub fn fingerprint(
    image_bytes: &[u8]
) -> Result<MultiHashFingerprint, ImgFprintError>
```

Computes **both PHash and DHash** in parallel for maximum accuracy.

**Returns:**
- `MultiHashFingerprint` containing:
  - SHA256 hash of original bytes (exact matching)
  - PHash results: global + 16 block hashes
  - DHash results: global + 16 block hashes

**Example:**
```rust
use imgfprint::ImageFingerprinter;

let image_bytes = std::fs::read("image.png")?;
let fingerprint = ImageFingerprinter::fingerprint(&image_bytes)?;

// Access individual algorithms
let phash = fingerprint.phash();
let dhash = fingerprint.dhash();
```

#### Single Algorithm Mode

##### `fingerprint_with()`

```rust
pub fn fingerprint_with(
    image_bytes: &[u8],
    algorithm: HashAlgorithm
) -> Result<ImageFingerprint, ImgFprintError>
```

Computes a single perceptual hash using the specified algorithm.

**Algorithms:**
- `HashAlgorithm::PHash` - DCT-based (robust to compression)
- `HashAlgorithm::DHash` - Gradient-based (fast, good for structural changes)

**Example:**
```rust
use imgfprint::{ImageFingerprinter, HashAlgorithm};

// Use only DHash (faster than computing both)
let fp = ImageFingerprinter::fingerprint_with(
    &image_bytes,
    HashAlgorithm::DHash
)?;
```

#### `compare()`

```rust
pub fn compare(
    a: &ImageFingerprint,
    b: &ImageFingerprint
) -> Similarity
```

Compares two fingerprints and returns a similarity score.

**Note:** For `MultiHashFingerprint`, use the `compare()` method directly on the struct for weighted multi-algorithm comparison.

**Returns:**
- `Similarity` struct with:
  - `score`: 0.0 (different) to 1.0 (identical)
  - `exact_match`: true if SHA256 hashes match
  - `perceptual_distance`: Hamming distance 0-64

**Example:**
```rust
let sim = ImageFingerprinter::compare(&fp1, &fp2);

println!("Score: {:.2}", sim.score);              // 0.0 - 1.0
println!("Exact match: {}", sim.exact_match);      // true/false
println!("Distance: {}", sim.perceptual_distance); // 0-64
```

**Similarity Thresholds:**

| Score Range | Interpretation |
|-------------|----------------|
| 1.0 | Identical images |
| 0.8 - 1.0 | Same image, minor edits |
| 0.5 - 0.8 | Visually similar |
| < 0.5 | Different images |

#### `fingerprint_batch()`

```rust
pub fn fingerprint_batch<S>(
    images: &[(S, Vec<u8>)]
) -> Vec<(S, Result<ImageFingerprint, ImgFprintError>)>
where
    S: Send + Sync + Clone + 'static
```

Processes multiple images in parallel (requires `parallel` feature).

**Example:**
```rust
let images = vec![
    ("img1.jpg".to_string(), std::fs::read("img1.jpg")?),
    ("img2.jpg".to_string(), std::fs::read("img2.jpg")?),
    ("img3.jpg".to_string(), std::fs::read("img3.jpg")?),
];

let results = ImageFingerprinter::fingerprint_batch(&images);

for (id, result) in results {
    match result {
        Ok(fp) => println!("{}: fingerprinted successfully", id),
        Err(e) => println!("{}: error - {}", id, e),
    }
}
```

**Performance Note:** With the `parallel` feature enabled (default), batch processing uses all available CPU cores for 2-3x speedup.

---

### FingerprinterContext

High-performance context for repeated fingerprinting with buffer reuse. Recommended for processing thousands of images.

#### `new()`

```rust
pub fn new() -> Self
```

Creates a new context with cached resources.

**Example:**
```rust
use imgfprint::FingerprinterContext;

let mut ctx = FingerprinterContext::new();
```

#### `fingerprint()`

```rust
pub fn fingerprint(
    &mut self,
    image_bytes: &[u8]
) -> Result<MultiHashFingerprint, ImgFprintError>
```

Computes **all hashes** (PHash + DHash) in parallel using internal buffer reuse.

**Example:**
```rust
use imgfprint::FingerprinterContext;

let mut ctx = FingerprinterContext::new();

// Process thousands of images efficiently
for path in image_paths {
    let bytes = std::fs::read(path)?;
    let fp = ctx.fingerprint(&bytes)?;
    // fp is MultiHashFingerprint
}
```

**Performance:** Context API saves approximately 260KB of allocations per image compared to the static API. Essential for high-throughput scenarios (10M+ images/day).

#### `fingerprint_with()`

```rust
pub fn fingerprint_with(
    &mut self,
    image_bytes: &[u8],
    algorithm: HashAlgorithm
) -> Result<ImageFingerprint, ImgFprintError>
```

Computes a **single algorithm** fingerprint using internal buffer reuse.

**Example:**
```rust
use imgfprint::{FingerprinterContext, HashAlgorithm};

let mut ctx = FingerprinterContext::new();

// Process only DHash for speed
for path in image_paths {
    let bytes = std::fs::read(path)?;
    let fp = ctx.fingerprint_with(&bytes, HashAlgorithm::DHash)?;
    // Process fingerprint...
}
```

---

### ImageFingerprint

A perceptual fingerprint containing multiple hash layers for robust comparison.

#### Accessors

##### `exact_hash()`

```rust
pub fn exact_hash(&self) -> &[u8; 32]
```

Returns the SHA256 hash of original image bytes.

**Use case:** Exact deduplication before perceptual comparison (much faster).

**Example:**
```rust
let exact: &[u8; 32] = fp.exact_hash();

// Convert to hex string
let hex = hex::encode(exact);
println!("Exact hash: {}", hex);
```

##### `global_phash()`

```rust
pub fn global_phash(&self) -> u64
```

Returns the global perceptual hash from the center 32x32 region.

**Example:**
```rust
let phash: u64 = fp.global_phash();
println!("Perceptual hash: {:016x}", phash);
```

##### `block_hashes()`

```rust
pub fn block_hashes(&self) -> &[u64; 16]
```

Returns 16 block-level hashes from a 4x4 grid.

**Use case:** Crop-resistant comparison by matching partial regions.

**Example:**
```rust
let blocks: &[u64; 16] = fp.block_hashes();

// Access individual blocks
for (i, hash) in blocks.iter().enumerate() {
    println!("Block {}: {:016x}", i, hash);
}
```

#### Comparison Methods

##### `distance()`

```rust
pub fn distance(&self, other: &ImageFingerprint) -> u32
```

Computes Hamming distance between global hashes.

**Returns:** 0 (identical) to 64 (completely different)

**Example:**
```rust
let dist = fp1.distance(&fp2);
println!("Hamming distance: {} (lower is more similar)", dist);

// Convert to similarity percentage
let similarity = 1.0 - (dist as f32 / 64.0);
```

##### `is_similar()`

```rust
pub fn is_similar(&self, other: &ImageFingerprint, threshold: f32) -> bool
```

Checks if this fingerprint is similar to another within a threshold.

**Parameters:**
- `other`: Fingerprint to compare against
- `threshold`: Similarity threshold 0.0 to 1.0 (default: 0.8)

**Example:**
```rust
// Check if images are 80% similar
if fp1.is_similar(&fp2, 0.8) {
    println!("Images are similar!");
}

// Stricter matching (90%)
if fp1.is_similar(&fp2, 0.9) {
    println!("Images are nearly identical!");
}

// Loose matching (50%)
if fp1.is_similar(&fp2, 0.5) {
    println!("Images share some visual elements");
}
```

**Note:** A threshold of 1.0 requires exact match (both SHA256 and perceptual hash identical).

---

### MultiHashFingerprint

A multi-algorithm fingerprint containing both PHash and DHash results for enhanced accuracy.

#### Accessors

##### `exact_hash()`

```rust
pub fn exact_hash(&self) -> &[u8; 32]
```

Returns the SHA256 hash of original image bytes.

##### `phash()`

```rust
pub fn phash(&self) -> &ImageFingerprint
```

Returns the PHash-based fingerprint (global + block hashes).

##### `dhash()`

```rust
pub fn dhash(&self) -> &ImageFingerprint
```

Returns the DHash-based fingerprint (global + block hashes).

**Example:**
```rust
let multi = ImageFingerprinter::fingerprint(&image_bytes)?;

// Access individual algorithms
let phash = multi.phash();
let dhash = multi.dhash();

println!("PHash: {:016x}", phash.global_phash());
println!("DHash: {:016x}", dhash.global_phash());
```

##### `get()`

```rust
pub fn get(&self, algorithm: HashAlgorithm) -> &ImageFingerprint
```

Returns the fingerprint for a specific algorithm.

**Example:**
```rust
use imgfprint::HashAlgorithm;

let fp = multi.get(HashAlgorithm::PHash);
```

#### Comparison Methods

##### `compare()`

```rust
pub fn compare(&self, other: &MultiHashFingerprint) -> Similarity
```

Compares two multi-hash fingerprints using weighted combination.

**Weights:**
- **60%** PHash similarity (DCT-based, robust to compression)
- **40%** DHash similarity (gradient-based, good for structural changes)

**Example:**
```rust
let multi1 = ImageFingerprinter::fingerprint(&img1)?;
let multi2 = ImageFingerprinter::fingerprint(&img2)?;

// Weighted comparison
let sim = multi1.compare(&multi2);
println!("Combined similarity: {:.2}", sim.score);
```

##### `is_similar()`

```rust
pub fn is_similar(&self, other: &MultiHashFingerprint, threshold: f32) -> bool
```

Checks if this fingerprint is similar to another within a threshold.

**Example:**
```rust
if multi1.is_similar(&multi2, 0.8) {
    println!("Images are similar!");
}
```

---

### Similarity

Similarity score between two image fingerprints.

#### Fields

| Field | Type | Description |
|-------|------|-------------|
| `score` | `f32` | Similarity 0.0 (different) to 1.0 (identical) |
| `exact_match` | `bool` | True if SHA256 hashes match |
| `perceptual_distance` | `u32` | Hamming distance 0-64 |

#### Methods

##### `perfect()`

```rust
pub fn perfect() -> Self
```

Returns a perfect similarity score (1.0, exact match).

**Example:**
```rust
let perfect = imgfprint::Similarity::perfect();
assert_eq!(perfect.score, 1.0);
assert!(perfect.exact_match);
```

---

## Advanced Usage

### Batch Processing

Process thousands of images efficiently using two strategies:

#### Strategy 1: Parallel Batch (Best for Many Images)

Uses all CPU cores for maximum throughput:

```rust
use imgfprint::ImageFingerprinter;
use std::path::Path;

fn process_parallel(image_paths: &[&Path]) -> Result<(), Box<dyn std::error::Error>> {
    let images: Vec<_> = image_paths
        .iter()
        .map(|p| (p.to_string_lossy().to_string(), std::fs::read(p).unwrap()))
        .collect();
    
    let results = ImageFingerprinter::fingerprint_batch(&images);
    
    for (path, result) in results {
        match result {
            Ok(fp) => {
                // Store in database, index, etc.
                db.store(&path, fp)?;
            }
            Err(e) => eprintln!("Failed to process {}: {}", path, e),
        }
    }
    
    Ok(())
}
```

**Speedup:** 2-3x on multi-core systems.

#### Strategy 2: Streaming with Context (Best for Memory-Constrained)

Lower memory usage, ideal for processing large datasets:

```rust
use imgfprint::FingerprinterContext;
use std::path::Path;

fn process_streaming(image_paths: &[&Path]) -> Result<(), Box<dyn std::error::Error>> {
    let mut ctx = FingerprinterContext::new();
    
    for path in image_paths {
        let bytes = std::fs::read(path)?;
        let fp = ctx.fingerprint(&bytes)?;
        db.store(&path.to_string_lossy(), fp)?;
    }
    
    Ok(())
}
```

**Benefit:** Minimal memory footprint, processes images one at a time.

### Semantic Embeddings

Work with CLIP-style semantic embeddings (requires custom provider implementation).

#### Custom Provider Example

```rust
use imgfprint::{Embedding, EmbeddingProvider, ImgFprintError};

struct MyClipProvider {
    client: reqwest::Client,
    api_key: String,
}

impl EmbeddingProvider for MyClipProvider {
    fn embed(&self, image: &[u8]) -> Result<Embedding, ImgFprintError> {
        let response = self.client
            .post("https://api.example.com/embed")
            .header("Authorization", &self.api_key)
            .body(image.to_vec())
            .send()
            .map_err(|e| ImgFprintError::ProviderError(e.to_string()))?;
        
        let vector: Vec<f32> = response.json()
            .map_err(|e| ImgFprintError::ProviderError(e.to_string()))?;
        
        Embedding::new(vector)
    }
}

// Usage
let provider = MyClipProvider { 
    client: reqwest::Client::new(),
    api_key: "your-api-key".to_string(),
};

let img1 = std::fs::read("cat.jpg")?;
let img2 = std::fs::read("dog.jpg")?;

let emb1 = provider.embed(&img1)?;
let emb2 = provider.embed(&img2)?;

let similarity = imgfprint::semantic_similarity(&emb1, &emb2)?;
println!("Semantic similarity: {:.4}", similarity);
```

**Note:** The library does not include built-in embedding providers. You must implement `EmbeddingProvider` for your use case (OpenAI CLIP, HuggingFace, local models, etc.).

#### Local ONNX Models

With the `local-embedding` feature:

```toml
[dependencies]
imgfprint = { version = "0.1.2", features = ["local-embedding"] }
```

```rust
use imgfprint::{LocalProvider, LocalProviderConfig};

// Load CLIP model
let provider = LocalProvider::from_file("clip-vit-base-patch32.onnx")?;

// Or with custom configuration
let config = LocalProviderConfig::clip_vit_large_patch14();
let provider = LocalProvider::from_file_with_config("clip.onnx", config)?;

// Generate embedding
let image = std::fs::read("photo.jpg")?;
let embedding = provider.embed(&image)?;

println!("Generated {}-dimensional embedding", embedding.len());
```

---

## Error Handling

All operations return `Result<T, ImgFprintError>`. The library never panics on malformed input.

### Creating Errors (For SDK Users)

When implementing custom providers or extending the library, use the optimized error constructors:

```rust
use imgfprint::ImgFprintError;

let err = ImgFprintError::decode_error("invalid format");
let err = ImgFprintError::invalid_image("dimensions too large");
let err = ImgFprintError::processing_error("resize failed");

let size = 1024;
let err = ImgFprintError::invalid_image(format!("image too large: {} bytes", size));
```

### Complete Error Handling Example

```rust
use imgfprint::{ImageFingerprinter, ImgFprintError};

match ImageFingerprinter::fingerprint(&bytes) {
    Ok(fp) => {
        // Use fingerprint
    }
    
    // Image-related errors
    Err(ImgFprintError::InvalidImage(msg)) => {
        eprintln!("Invalid image: {}", msg);
    }
    Err(ImgFprintError::UnsupportedFormat(msg)) => {
        eprintln!("Unsupported format: {}", msg);
    }
    Err(ImgFprintError::DecodeError(msg)) => {
        eprintln!("Decode failed: {}", msg);
    }
    Err(ImgFprintError::ImageTooSmall(msg)) => {
        eprintln!("Image too small: {} (minimum 32x32)", msg);
    }
    
    // Processing errors
    Err(ImgFprintError::ProcessingError(msg)) => {
        eprintln!("Processing error: {}", msg);
    }
    
    // Embedding errors
    Err(ImgFprintError::EmbeddingDimensionMismatch { expected, actual }) => {
        eprintln!("Dimension mismatch: expected {}, got {}", expected, actual);
    }
    Err(ImgFprintError::ProviderError(msg)) => {
        eprintln!("Provider error: {}", msg);
    }
    Err(ImgFprintError::InvalidEmbedding(msg)) => {
        eprintln!("Invalid embedding: {}", msg);
    }
}
```

---

## Performance Tips

### 1. Use Context API for High Throughput

**Avoid:** Creating new allocations for each image
```rust
// Slow: Allocates buffers for each image
for path in paths {
    let fp = ImageFingerprinter::fingerprint(&std::fs::read(path)?)?;
}
```

**Prefer:** Buffer reuse with context
```rust
// Fast: Reuses buffers
let mut ctx = FingerprinterContext::new();
for path in paths {
    let fp = ctx.fingerprint(&std::fs::read(path)?)?;
}
```

**Savings:** ~260KB allocations per image eliminated.

### 2. Use Batch Processing for Parallel Workloads

```rust
// Process 100 images in parallel using all CPU cores
let results = ImageFingerprinter::fingerprint_batch(&images);
```

**Speedup:** 2-3x on multi-core systems.

### 3. Check Exact Hash First

```rust
// Fast path: exact byte match (SHA256 comparison)
if fp1.exact_hash() == fp2.exact_hash() {
    return Similarity::perfect();
}

// Slow path: perceptual comparison (DCT-based)
let sim = ImageFingerprinter::compare(&fp1, &fp2);
```

### 4. Handle Common Formats Efficiently

Supported formats: PNG, JPEG, GIF, WebP, BMP

| Format | Decode Speed | Best For |
|--------|--------------|----------|
| PNG | Fast | Synthetic images, screenshots |
| JPEG | Medium | Photos (use `zune-jpeg` for 2-3x speedup) |
| WebP | Slow | Web-optimized images |
| GIF | Fast | Simple graphics |

### 5. Image Size Guidelines

| Metric | Value | Notes |
|--------|-------|-------|
| Minimum | 32x32 pixels | Enforced |
| Maximum | 8192x8192 pixels | OOM protection |
| Optimal | 256x512 to 1024x1024 | Best performance |

**Note:** Larger images are downscaled to 256x256 internally, so feeding very large images wastes decode time.

---

## Feature Flags

Configure the library for your needs:

```toml
[dependencies]
# Minimal build (no parallel processing)
imgfprint = { version = "0.1.2", default-features = false }

# Default (serialization + parallel processing)
imgfprint = "0.1.2"

# With local ONNX inference
imgfprint = { version = "0.1.2", features = ["local-embedding"] }
```

### Available Features

| Feature | Default | Description |
|---------|---------|-------------|
| `serde` | Yes | Serialization support (JSON, binary) via serde |
| `parallel` | Yes | Parallel batch processing using rayon |
| `local-embedding` | No | Local ONNX model inference for embeddings |

---

## License

MIT License - See LICENSE file for details.

## Links

- [Crates.io]https://crates.io/crates/imgfprint
- [Documentation]https://docs.rs/imgfprint
- [Repository]https://github.com/themankindproject/imgfprint-rs