or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

cli.mdcore-processing.mddata-structures.mdexceptions.mdheic.mdindex.mdlogging.mdutilities.md

cli.mddocs/

0

# Command Line Interface

1

2

Command-line tool for extracting and displaying EXIF metadata from image files. The `EXIF.py` script provides comprehensive metadata extraction with various processing options and output formats.

3

4

## Capabilities

5

6

### Main Command Line Function

7

8

Entry point for the command-line interface with argument parsing and file processing.

9

10

```python { .api }

11

def main():

12

"""

13

Parse command line options/arguments and execute EXIF extraction.

14

15

Processes each file specified on command line, extracts EXIF metadata,

16

and displays results with timing information and error handling.

17

"""

18

19

def get_args():

20

"""

21

Parse and return command line arguments.

22

23

Returns:

24

argparse.Namespace: Parsed command line arguments with the following attributes:

25

- files: List[str], image files to process

26

- detailed: bool, process MakerNotes (inverse of --quick)

27

- stop_tag: str, tag name to stop processing at

28

- strict: bool, strict processing mode

29

- debug: bool, enable debug output

30

- color: bool, enable colored output

31

"""

32

```

33

34

## Command Line Usage

35

36

### Basic Usage

37

38

Extract and display EXIF data from image files:

39

40

```bash

41

# Single file

42

EXIF.py photo.jpg

43

44

# Multiple files

45

EXIF.py photo1.jpg photo2.tiff photo3.png

46

47

# Process all JPEG files in directory

48

find ~/Pictures -name "*.jpg" | xargs EXIF.py

49

```

50

51

### Command Line Options

52

53

The EXIF.py script supports the following options:

54

55

```bash

56

# Display version information

57

EXIF.py --version

58

EXIF.py -v

59

60

# Quick processing (skip MakerNotes for faster processing)

61

EXIF.py --quick photo.jpg

62

EXIF.py -q photo.jpg

63

64

# Stop processing at specific tag

65

EXIF.py --tag DateTimeOriginal photo.jpg

66

EXIF.py -t DateTimeOriginal photo.jpg

67

68

# Strict mode (stop on errors instead of continuing)

69

EXIF.py --strict photo.jpg

70

EXIF.py -s photo.jpg

71

72

# Debug mode (verbose output with processing details)

73

EXIF.py --debug photo.jpg

74

EXIF.py -d photo.jpg

75

76

# Colored output (works with debug on POSIX systems)

77

EXIF.py --debug --color photo.jpg

78

EXIF.py -d -c photo.jpg

79

80

# Combine options

81

EXIF.py -qsc photo.jpg # Quick, strict, colored processing

82

```

83

84

### Help Information

85

86

```bash

87

# Display help message

88

EXIF.py --help

89

EXIF.py -h

90

```

91

92

## Usage Examples

93

94

### Basic EXIF Extraction

95

96

```bash

97

# Extract EXIF from a single photo

98

$ EXIF.py DSC001.jpg

99

100

Opening: DSC001.jpg

101

Image Make (ASCII): Canon

102

Image Model (ASCII): Canon EOS 5D Mark IV

103

Image DateTime (ASCII): 2023:08:15 14:30:22

104

EXIF DateTimeOriginal (ASCII): 2023:08:15 14:30:22

105

EXIF ExposureTime (Ratio): 1/125

106

EXIF FNumber (Ratio): 8/1

107

EXIF ISOSpeedRatings (Short): 200

108

EXIF FocalLength (Ratio): 85/1

109

GPS GPSLatitude (Ratio): [40, 45, 32401/1000]

110

GPS GPSLongitude (Ratio): [73, 59, 8599/1000]

111

File has JPEG thumbnail

112

```

113

114

### Quick Processing Mode

115

116

```bash

117

# Skip MakerNotes for faster processing of many files

118

$ EXIF.py -q *.jpg

119

120

Opening: photo1.jpg

121

Image Make (ASCII): Sony

122

Image Model (ASCII): ILCE-7R III

123

EXIF DateTimeOriginal (ASCII): 2023:07:20 09:15:33

124

125

Opening: photo2.jpg

126

Image Make (ASCII): Nikon

127

Image Model (ASCII): D850

128

EXIF DateTimeOriginal (ASCII): 2023:07:20 10:22:18

129

```

130

131

### Stop at Specific Tag

132

133

```bash

134

# Stop processing after finding the date taken

135

$ EXIF.py -t DateTimeOriginal vacation/*.jpg

136

137

Opening: IMG001.jpg

138

Image Make (ASCII): Apple

139

Image Model (ASCII): iPhone 13 Pro

140

EXIF DateTimeOriginal (ASCII): 2023:06:10 16:45:12

141

142

Opening: IMG002.jpg

143

Image Make (ASCII): Apple

144

Image Model (ASCII): iPhone 13 Pro

145

EXIF DateTimeOriginal (ASCII): 2023:06:10 17:23:08

146

```

147

148

### Debug Mode Output

149

150

```bash

151

# Enable verbose debug output

152

$ EXIF.py -d photo.jpg

153

154

Opening: photo.jpg

155

DEBUG JPEG format recognized data[0:2]=0xFFD8

156

DEBUG APP1 at base 0x14

157

DEBUG Length: 0x22 0x5E

158

DEBUG Code: Exif

159

DEBUG Endian format is I (Intel)

160

DEBUG IFD 0 (Image) at offset 18:

161

DEBUG Make: (0x010F) ASCII=Canon @ 150

162

DEBUG Model: (0x0110) ASCII=Canon EOS 5D Mark IV @ 156

163

DEBUG Exif SubIFD at offset 180:

164

DEBUG DateTimeOriginal: (0x9003) ASCII=2023:08:15 14:30:22 @ 344

165

INFO Tags processed in 0.003 seconds

166

INFO File processed in 0.008 seconds

167

```

168

169

### Strict Mode Processing

170

171

```bash

172

# Stop on errors instead of continuing

173

$ EXIF.py -s corrupted_photo.jpg

174

175

Opening: corrupted_photo.jpg

176

ERROR Unknown type 255 in tag 0x0001

177

```

178

179

### Batch Processing with Error Handling

180

181

```bash

182

# Process all images in a directory with error handling

183

$ find ~/Photos -name "*.jpg" -o -name "*.tiff" | xargs EXIF.py -q

184

185

Opening: /home/user/Photos/IMG001.jpg

186

Image Make (ASCII): Canon

187

...

188

189

Opening: /home/user/Photos/corrupted.jpg

190

WARNING No EXIF information found

191

192

Opening: /home/user/Photos/IMG003.jpg

193

Image Make (ASCII): Sony

194

...

195

```

196

197

### Using with Shell Scripts

198

199

```bash

200

#!/bin/bash

201

# Extract creation dates from photos

202

203

for photo in "$@"; do

204

echo "Processing: $photo"

205

EXIF.py -t DateTimeOriginal "$photo" 2>/dev/null | grep "DateTimeOriginal" | cut -d: -f2-

206

done

207

```

208

209

### Performance Timing

210

211

The command line tool automatically reports processing times:

212

213

```bash

214

$ EXIF.py -d large_photo.jpg

215

216

# ... EXIF output ...

217

218

DEBUG Tags processed in 0.015 seconds

219

DEBUG File processed in 0.032 seconds

220

```

221

222

### Integration with Other Tools

223

224

```bash

225

# Count photos by camera make

226

$ find ~/Photos -name "*.jpg" | xargs EXIF.py -q | grep "Image Make" | sort | uniq -c

227

228

42 Image Make (ASCII): Canon

229

28 Image Make (ASCII): Nikon

230

15 Image Make (ASCII): Sony

231

232

# Extract GPS coordinates to CSV

233

$ EXIF.py photo.jpg | grep "GPS GPS" | sed 's/.*: //' > gps_data.txt

234

```