cmc/cleberg.net

My personal web garden & blog.

clone: git clone https://gitbay.org/cmc/cleberg.net.git

main: content/blog/2022-02-17-exiftool.org · raw

 1#+date:        [2022-02-17 Thu 00:00:00]
 2#+title:       ExifTool: Strip Metadata Before You Post
 3#+description: How to use ExifTool to strip metadata from images before sharing them.
 4#+slug:        exiftool
 5#+filetags:    :linux:privacy:
 6
 7** Why Strip Metadata?
 8
 9Okay, so you want to strip metadata from your photos. Perhaps you take pictures
10of very rare birds, and the location metadata is a gold mine for poachers, or
11perhaps you're just privacy-oriented like me and prefer to strip metadata from
12publicly-available images.
13
14There are various components of image metadata that you may want to delete
15before releasing a photo to the public. Here's an incomplete list of things I
16could easily see just by inspecting a photo on my laptop:
17
18- Location (Latitude & Longitude)
19- Dimensions
20- Device Make & Model
21- Color Space
22- Color Profile
23- Focal Length
24- Alpha Channel
25- Red Eye
26- Metering Mode
27- F Number
28
29Regardless of your reasoning, I'm going to explain how I used the =exiftool=
30package in Linux to automatically strip metadata from all images in a directory
31(+ subdirectories).
32
33** Installing =exiftool=
34
35First things first: we need to install the tool. I'm running Debian 11 on my
36server (Ubuntu will work the same), so the command is as simple as:
37
38#+begin_src sh
39sudo apt install exiftool
40#+end_src
41
42There are different tools that can accomplish the same thing across
43distributions, but I really only care to test out this one package.
44
45** Recursively Strip Data
46
47I actually use this tool extensively to strip any photos uploaded to the website
48that serves all the images for my blog (=img.cleberg.net=).
49
50The following command is incredibly useful and can be modified to include any
51image extensions that =exiftool= supports:
52
53#+begin_src sh
54exiftool -r -all= -ext jpg -ext png /path/to/directory/
55#+end_src
56
57The output of the command will let you know how many directories were scanned,
58how many images were updated, and how many images were unchanged.