aboutsummaryrefslogtreecommitdiffstats
path: root/README.md
blob: b870d9f70e1a69722ebcf5d74f499073ac965686 (plain)
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
# imgst

`imgst` is a command-line tool for processing and metadata removal from
image files (currently JPEG).

It recursively scans a directory, removes metadata such as EXIF, and writes the
cleaned files into a separate output directory while preserving the folder
structure.

## Why

When publishing images on websites or sharing them publicly, embedded metadata
(EXIF) may leak sensitive information:

- GPS coordinates
- Device information (camera model, serial)
- Date and time the photo was taken
- Thumbnails containing past edits
- Optional personal identifiers

Images uploaded from mobile devices frequently include **location metadata**,
which can expose private home or workplace addresses.

Additionally, metadata increases file size, affecting storage and page load
performance.

### Safer and lighter images

By stripping metadata:

- No privacy-leaking metadata remains
- Storage and bandwidth usage shrink
- Website performance improves

## Features

- Recursive directory scanning with ignore rules (`.gitignore`, `.ignore`)
- JPEG EXIF metadata removal (`web-image-meta`)
- Preserves the directory hierarchy
- Parallel processing for performance
- Dry-run mode shows what would be processed without modifying files
- Optional statistics (`--stats`) including total space savings
- Logging with adjustable verbosity (`-v`, `RUST_LOG`)

## Requirements

- Rust toolchain (Rust 1.89 or newer recommended)

To install Rust:

```sh
curl https://sh.rustup.rs -sSf | sh
```

Verify installation:

```sh
rustc --version
cargo --version
```

## Building

Clone the repository and build the binary:

- **Official**: ssh://anon@ijanc.org/imgst
- Mirror Sourcehut: git@git.sr.ht:~ijanc/imgst
- Mirror Github: git@github.com:ijanc/imgst.git

```sh
git clone ssh://anon@ijanc.org/imgst
cd imgst
cargo build --release
```

The binary will be located at:

```
target/release/imgst
```

You can add it to your PATH or move it to `/usr/local/bin`.

or

```
cargo install --path .
```

## Command Overview

`imgst` currently supports one primary operation:

### Metadata Cleaning

Recursively removes metadata from image files and writes the result to a
separate output folder:

```sh
imgst --input ./photos --output ./public/photos
```

Preserves folder structure:

```
photos/
 └── albums/
     └── party/
         └── img_001.jpg

public/photos/
 └── albums/
     └── party/
         └── img_001.jpg  <-- cleaned
```

### Dry-run mode

Shows what would be processed but does not write anything:

```sh
imgst -i ./photos -o ./out --dry-run -v
```

### Statistics mode

Display space savings after completion:

```sh
imgst -i ./photos -o ./out --stats
```

Example output:

```
Stats:
  Original total : 9.83 GB
  Clean total    : 8.97 GB
  Saved          : 860 MB (8.7%)
```

## Logging and verbosity

`imgst` uses standard Rust logging (`env_logger`).

Default level: **INFO**

Use `-v` to enable DEBUG:

```sh
imgst -v -i ./photos -o ./out
```

Or configure directly:

```sh
RUST_LOG=debug imgst ...
```

## License

Licensed under the ISC license\
(see [`LICENSE`](LICENSE) or https://opensource.org/licenses/ISC)