crates/veilvoice-meta/src/image.rs
veilvoice-meta · 210 lines · read the source here · or on GitHub
Image EXIF/GPS removal.
Images are handled at the container level with img-parts: the EXIF and XMP segments are dropped and the compressed pixel data is copied through untouched. Nothing is re-encoded, so cleaning is lossless and cannot introduce visible artefacts.
GPS coordinates are the reason this matters most. A single holiday snapshot attached to an otherwise anonymous message can place someone within a few metres, and no amount of voice processing helps with that.
In plain words
Strips the hidden information out of a picture, including where it was taken.
Photographs from a phone routinely carry the exact location, the time, the device and its serial number. The picture is copied through untouched and only those sections are dropped, so nothing about how it looks changes.
WHAT THIS FILE CONTAINS
210 lines defining 3 functions (3 public), 1 type and 0 constants. Everything below is read out of the source, so it cannot disagree with the code.
The types it owns.
enum ImageKindline 27 · Image container formats this crate can clean.
What happens when it runs. These are the ways in: public, and nothing else in this file calls them, so they are what an outside caller reaches first.
clean_image_fileline 94 · Strip identifying metadata from an image file, in place.
reachesclean_image_bytes,sniff
WHAT CALLS WHAT
The functions this file defines, and the calls between them. An edge means the callee's name appears, called, inside the caller's body. This is a syntactic reading, not a type-resolved one.
The same graph as Mermaid source
%%{init: {"theme":"base","themeVariables":{"background":"#1a1b26","primaryColor":"#1f2335","primaryTextColor":"#c0caf5","primaryBorderColor":"#7aa2f7","secondaryColor":"#16161e","tertiaryColor":"#16161e","lineColor":"#737aa2","textColor":"#c0caf5","mainBkg":"#1f2335","nodeBorder":"#7aa2f7","clusterBkg":"#16161e","clusterBorder":"#2f3549","fontFamily":"ui-monospace, SFMono-Regular, Consolas, monospace","fontSize":"14px"}}}%%
flowchart TD
n_sniff["ImageKind::sniff<br/>line 41"]
n_clean_image_bytes["clean_image_bytes<br/>line 57"]
n_clean_image_file(["clean_image_file<br/>line 94"])
n_clean_image_bytes --> n_sniff
n_clean_image_file --> n_clean_image_bytes
click n_sniff href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-meta/src/image.rs#L41" "open the source"
click n_clean_image_bytes href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-meta/src/image.rs#L57" "open the source"
click n_clean_image_file href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-meta/src/image.rs#L94" "open the source"
classDef entry fill:#1f2335,stroke:#7aa2f7,color:#c0caf5
class n_clean_image_file entry
classDef api fill:#1f2335,stroke:#7dcfff,color:#c0caf5
class n_sniff,n_clean_image_bytes api
This site loads no third-party script, so it cannot run Mermaid; the diagram above is the same nodes and edges drawn by the generator instead. GitHub renders the source below directly.
ITEMS
| Item | Line | Documentation |
|---|---|---|
ImageKind pub enum | 27 | Image container formats this crate can clean. |
ImageKind::sniff pub fn | 41 | Identify a format from its magic bytes. |
clean_image_bytes pub fn | 57 | Strip identifying metadata from encoded image bytes. |
clean_image_file pub fn | 94 | Strip identifying metadata from an image file, in place. |