Skip to content

Commit 0049f7b

Browse files
Merge pull request #4 from CSAFE-ISU/3-wipe_gps
Fixed bug in wipe_gps()
2 parents b6c6c69 + beddc17 commit 0049f7b

File tree

6 files changed

+29
-5
lines changed

6 files changed

+29
-5
lines changed

dev_how_to.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,12 @@ pytest -vv
1010
In the terminal
1111
```
1212
pytest --cov --cov-report=html:cov_html
13-
```
13+
```
14+
15+
## Upload a New Version to PyPi
16+
After all tests pass and the code coverage report has been generated,
17+
18+
1. Increment the version number in *pyproject.toml*
19+
2. Generate distribution archives: Run `python3 -m pip install --upgrade build` then `python3 -m build`
20+
3. Upload the distribution archives to TestPyPi: Run `python3 -m pip install --upgrade twine` then `python3 -m twine upload --repository testpypi dist/*`
21+
4. Upload the distribution archives to PyPi: Run `twine upload dist/*`

pyexifwrangle/wrangle.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,4 +159,4 @@ def wipe_gps(path):
159159
Returns:
160160
None
161161
"""
162-
os.system('exiftool -gps:all= ' + path)
162+
os.system('exiftool -gps:all= "' + path + '"')

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "pyexifwrangle"
7-
version = "0.2.0"
7+
version = "0.2.1"
88
authors = [
99
{ name="Stephanie Reinders", email="[email protected]" },
1010
]

tests/fixtures/get_exif.csv

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
SourceFile,AccelerationVector,Aperture,ApertureValue,BitsPerSample,BlueMatrixColumn,BlueTRC,BrightnessValue,ChromaticAdaptation,CircleOfConfusion,CMMFlags,ColorComponents,ColorSpace,ColorSpaceData,ComponentsConfiguration,CompositeImage,Compression,ConnectionSpaceIlluminant,CreateDate,DateTimeOriginal,DependentImage1EntryNumber,DependentImage2EntryNumber,DeviceAttributes,DeviceManufacturer,DeviceModel,DigitalZoomRatio,Directory,EncodingProcess,ExifByteOrder,ExifImageHeight,ExifImageWidth,ExifToolVersion,ExifVersion,ExposureCompensation,ExposureMode,ExposureProgram,ExposureTime,FileAccessDate,FileInodeChangeDate,FileModifyDate,FileName,FilePermissions,FileSize,FileType,FileTypeExtension,Flash,FlashpixVersion,FNumber,FocalLength,FocalLength35efl,FocalLengthIn35mmFormat,FOV,GPSAltitude,GPSAltitudeRef,GPSDateStamp,GPSDestBearing,GPSDestBearingRef,GPSHPositioningError,GPSImgDirection,GPSImgDirectionRef,GPSLatitude,GPSLatitudeRef,GPSLongitude,GPSLongitudeRef,GPSPosition,GPSSpeed,GPSSpeedRef,GreenMatrixColumn,GreenTRC,HostComputer,HyperfocalDistance,ImageHeight,ImageSize,ImageUniqueID,ImageWidth,ISO,JFIFVersion,LensID,LensInfo,LensMake,LensModel,LightValue,Make,MaxApertureValue,MediaWhitePoint,Megapixels,MeteringMode,MIMEType,Model,ModifyDate,MPFVersion,MPImage2,MPImageFlags,MPImageFormat,MPImageLength,MPImageStart,MPImageType,NumberOfImages,OffsetTime,OffsetTimeDigitized,OffsetTimeOriginal,Orientation,PrimaryPlatform,ProfileClass,ProfileCMMType,ProfileConnectionSpace,ProfileCopyright,ProfileCreator,ProfileDateTime,ProfileDescription,ProfileFileSignature,ProfileID,ProfileVersion,RedMatrixColumn,RedTRC,RenderingIntent,ResolutionUnit,RunTimeEpoch,RunTimeFlags,RunTimeScale,RunTimeSincePowerUp,RunTimeValue,ScaleFactor35efl,SceneCaptureType,SceneType,SensingMethod,ShutterSpeed,ShutterSpeedValue,Software,SubjectArea,SubSecCreateDate,SubSecDateTimeOriginal,SubSecModifyDate,SubSecTimeDigitized,SubSecTimeOriginal,ThumbnailImage,ThumbnailLength,ThumbnailOffset,TimeStamp,Warning,WhiteBalance,XResolution,YCbCrPositioning,YCbCrSubSampling,YResolution
2-
tests/fixtures/images/20221002_144553.jpg,,2.2,2.2,8,,,2.23,,0.004 mm,,3,sRGB,,,,JPEG (old-style),,2022:10:02 14:45:53,2022:10:02 14:45:53,,,,,,1.23,tests/fixtures/images,"Baseline DCT, Huffman coding","Little-endian (Intel, II)",2208,2944,12.4,220,0,Auto,Program AE,1/50,2023:09:07 10:38:01-05:00,2023:09:07 10:02:50-05:00,2022:10:02 14:45:54-05:00,20221002_144553.jpg,-rwxrwxrwx,1448 KiB,JPEG,jpg,No Flash,,2.2,3.3 mm,3.3 mm (35 mm equivalent: 25.0 mm),25 mm,71.5 deg,,,,,,,,,,,,,,,,,,,1.25 m,2208,2944x2208,R64QLMF00SM,2944,400,,,,,,5.9,samsung,2.2,,6.5,Center-weighted average,image/jpeg,SM-G991U1,2022:10:02 14:45:53,,,,,,,,,+07:00,,+07:00,Rotate 90 CW,,,,,,,,,,,,,,,inches,,,,,,7.6,Standard,,,1/50,1,G991U1UEU2AUC8,,,2022:10:02 14:45:53+07:00,2022:10:02 14:45:53+07:00,,,"(Binary data 30296 bytes, use -b option to extract)",30296,812,2022:10:02 02:45:53-05:00,,Auto,72,Centered,YCbCr4:2:0 (2 2),72
2+
tests/fixtures/images/20221002_144553.jpg,,2.2,2.2,8,,,2.23,,0.004 mm,,3,sRGB,,,,JPEG (old-style),,2022:10:02 14:45:53,2022:10:02 14:45:53,,,,,,1.23,tests/fixtures/images,"Baseline DCT, Huffman coding","Little-endian (Intel, II)",2208,2944,12.4,220,0,Auto,Program AE,1/50,2023:11:17 08:42:10-06:00,2023:11:17 08:41:11-06:00,2022:10:02 14:45:54-05:00,20221002_144553.jpg,-rwxrwxrwx,1448 KiB,JPEG,jpg,No Flash,,2.2,3.3 mm,3.3 mm (35 mm equivalent: 25.0 mm),25 mm,71.5 deg,,,,,,,,,,,,,,,,,,,1.25 m,2208,2944x2208,R64QLMF00SM,2944,400,,,,,,5.9,samsung,2.2,,6.5,Center-weighted average,image/jpeg,SM-G991U1,2022:10:02 14:45:53,,,,,,,,,+07:00,,+07:00,Rotate 90 CW,,,,,,,,,,,,,,,inches,,,,,,7.6,Standard,,,1/50,1,G991U1UEU2AUC8,,,2022:10:02 14:45:53+07:00,2022:10:02 14:45:53+07:00,,,"(Binary data 30296 bytes, use -b option to extract)",30296,812,2022:10:02 02:45:53-05:00,,Auto,72,Centered,YCbCr4:2:0 (2 2),72
33
tests/fixtures/images/20221002_144551.jpg,,2.2,2.2,8,,,,,0.004 mm,,3,sRGB,,,,JPEG (old-style),,2022:10:02 14:45:52,2022:10:02 14:45:52,,,,,,1.23,tests/fixtures/images,"Baseline DCT, Huffman coding","Little-endian (Intel, II)",2208,2944,12.4,220,0,Auto,Program AE,1/33,2023:09:07 10:38:01-05:00,2023:09:07 10:02:50-05:00,2022:10:02 14:45:52-05:00,20221002_144551.jpg,-rwxrwxrwx,2030 KiB,JPEG,jpg,No Flash,,2.2,3.3 mm,3.3 mm (35 mm equivalent: 25.0 mm),25 mm,71.5 deg,,,,,,,,,,,,,,,,,,,1.25 m,2208,2944x2208,R64QLMF00SM,2944,800,,,,,,4.3,samsung,2.2,,6.5,Center-weighted average,image/jpeg,SM-G991U1,2022:10:02 14:45:52,,,,,,,,,+07:00,,+07:00,Rotate 90 CW,,,,,,,,,,,,,,,inches,,,,,,7.6,Standard,,,1/33,1,G991U1UEU2AUC8,,,2022:10:02 14:45:52+07:00,2022:10:02 14:45:52+07:00,,,"(Binary data 16199 bytes, use -b option to extract)",16199,792,2022:10:02 02:45:52-05:00,,Auto,72,Centered,YCbCr4:2:0 (2 2),72
44
tests/fixtures/images/20221002_144549.jpg,,2.2,2.2,8,,,6.76,,0.004 mm,,3,sRGB,,,,JPEG (old-style),,2022:10:02 14:45:49,2022:10:02 14:45:49,,,,,,1.23,tests/fixtures/images,"Baseline DCT, Huffman coding","Little-endian (Intel, II)",2208,2944,12.4,220,0,Auto,Program AE,1/100,2023:09:07 10:38:01-05:00,2023:09:07 10:02:50-05:00,2022:10:02 14:45:52-05:00,20221002_144549.jpg,-rwxrwxrwx,1894 KiB,JPEG,jpg,No Flash,,2.2,3.3 mm,3.3 mm (35 mm equivalent: 25.0 mm),25 mm,71.5 deg,,,,,,,,,,,,,,,,,,,1.25 m,2208,2944x2208,R64QLMF00SM,2944,250,,,,,,7.6,samsung,2.2,,6.5,Center-weighted average,image/jpeg,SM-G991U1,2022:10:02 14:45:49,,,,,,,,,+07:00,,+07:00,Rotate 90 CW,,,,,,,,,,,,,,,inches,,,,,,7.6,Standard,,,1/100,1,G991U1UEU2AUC8,,,2022:10:02 14:45:49+07:00,2022:10:02 14:45:49+07:00,,,"(Binary data 45271 bytes, use -b option to extract)",45271,812,2022:10:02 02:45:50-05:00,,Auto,72,Centered,YCbCr4:2:0 (2 2),72
5-
tests/fixtures/images/gps_example.JPG,-0.221040815 -0.1778482944 -0.9789179563,1.9,1.9,8,0.1571 0.06657 0.78407,"(Binary data 32 bytes, use -b option to extract)",3.697543924,1.04788 0.02292 -0.0502 0.02959 0.99048 -0.01706 -0.00923 0.01508 0.75168,0.003 mm,"Not Embedded, Independent",3,Uncalibrated,RGB ,"Y, Cb, Cr, -",General Composite Image,JPEG (old-style),0.9642 1 0.82491,2023:04:07 01:28:34,2023:04:07 01:28:34,0.0,0.0,"Reflective, Glossy, Positive, Color",Apple Computer Inc.,,,tests/fixtures/images,"Baseline DCT, Huffman coding","Big-endian (Motorola, MM)",2316,3088,12.4,232,0,Auto,Program AE,1/63,2023:11:13 11:17:13-06:00,2023:11:13 11:17:11-06:00,2023:04:07 01:29:59-05:00,gps_example.JPG,-rwxrwxrwx,2.5 MiB,JPEG,jpg,"Off, Did not fire",100.0,1.9,2.7 mm,2.7 mm (35 mm equivalent: 30.0 mm),30 mm,61.9 deg,369 m Above Sea Level,Above Sea Level,2023:04:07,254.1263885,True North,6202.480122 m,74.12638847,True North,"42 deg 1' 40.21"" N",North,"93 deg 39' 1.52"" W",West,"42 deg 1' 40.21"" N, 93 deg 39' 1.52"" W",0.0,km/h,0.29198 0.69225 0.04189,"(Binary data 32 bytes, use -b option to extract)",iPhone 14 Pro,1.41 m,2316,3088x2316,,3088,80,1.01,iPhone 14 Pro front camera 2.69mm f/1.9,2.690000057mm f/1.9,Apple,iPhone 14 Pro front camera 2.69mm f/1.9,8.2,Apple,,0.96419 1 0.82489,7.2,Multi-segment,image/jpeg,iPhone 14 Pro,2023:04:07 01:28:34,100.0,"(Binary data 76932 bytes, use -b option to extract)",(none),JPEG,76932.0,2503914.0,Undefined,2.0,-05:00,-05:00,-05:00,Rotate 90 CW,Apple Computer Inc.,Display Device Profile,Apple Computer Inc.,XYZ ,"Copyright Apple Inc., 2022",Apple Computer Inc.,2022:01:01 00:00:00,Display P3,acsp,ecfda38e388547c36db4bd4f7ada182f,4.0.0,0.51512 0.2412 -0.00105,"(Binary data 32 bytes, use -b option to extract)",Perceptual,inches,0.0,Valid,1000000000.0,11:02:38,39757691325208.0,11.2,Standard,Directly photographed,One-chip color area,1/63,1/63,16.2,1541 1154 1697 1016,2023:04:07 01:28:34.488-05:00,2023:04:07 01:28:34.488-05:00,2023:04:07 01:28:34-05:00,488.0,488.0,"(Binary data 5335 bytes, use -b option to extract)",5335,2720,,[minor] Bad format (16) for MakerNotes entry 10,Auto,72,Centered,YCbCr4:2:0 (2 2),72
5+
tests/fixtures/images/gps_example (0).JPG,-0.221040815 -0.1778482944 -0.9789179563,1.9,1.9,8,0.1571 0.06657 0.78407,"(Binary data 32 bytes, use -b option to extract)",3.697543924,1.04788 0.02292 -0.0502 0.02959 0.99048 -0.01706 -0.00923 0.01508 0.75168,0.003 mm,"Not Embedded, Independent",3,Uncalibrated,RGB ,"Y, Cb, Cr, -",General Composite Image,JPEG (old-style),0.9642 1 0.82491,2023:04:07 01:28:34,2023:04:07 01:28:34,0.0,0.0,"Reflective, Glossy, Positive, Color",Apple Computer Inc.,,,tests/fixtures/images,"Baseline DCT, Huffman coding","Big-endian (Motorola, MM)",2316,3088,12.4,232,0,Auto,Program AE,1/63,2023:11:17 08:41:28-06:00,2023:11:17 08:41:27-06:00,2023:11:17 08:41:17-06:00,gps_example (0).JPG,-rwxrwxrwx,2.5 MiB,JPEG,jpg,"Off, Did not fire",100.0,1.9,2.7 mm,2.7 mm (35 mm equivalent: 30.0 mm),30 mm,61.9 deg,369 m Above Sea Level,Above Sea Level,2023:04:07,254.1263885,True North,6202.480122 m,74.12638847,True North,"42 deg 1' 40.21"" N",North,"93 deg 39' 1.52"" W",West,"42 deg 1' 40.21"" N, 93 deg 39' 1.52"" W",0.0,km/h,0.29198 0.69225 0.04189,"(Binary data 32 bytes, use -b option to extract)",iPhone 14 Pro,1.41 m,2316,3088x2316,,3088,80,1.01,iPhone 14 Pro front camera 2.69mm f/1.9,2.690000057mm f/1.9,Apple,iPhone 14 Pro front camera 2.69mm f/1.9,8.2,Apple,,0.96419 1 0.82489,7.2,Multi-segment,image/jpeg,iPhone 14 Pro,2023:04:07 01:28:34,100.0,"(Binary data 76932 bytes, use -b option to extract)",(none),JPEG,76932.0,2503914.0,Undefined,2.0,-05:00,-05:00,-05:00,Rotate 90 CW,Apple Computer Inc.,Display Device Profile,Apple Computer Inc.,XYZ ,"Copyright Apple Inc., 2022",Apple Computer Inc.,2022:01:01 00:00:00,Display P3,acsp,ecfda38e388547c36db4bd4f7ada182f,4.0.0,0.51512 0.2412 -0.00105,"(Binary data 32 bytes, use -b option to extract)",Perceptual,inches,0.0,Valid,1000000000.0,11:02:38,39757691325208.0,11.2,Standard,Directly photographed,One-chip color area,1/63,1/63,16.2,1541 1154 1697 1016,2023:04:07 01:28:34.488-05:00,2023:04:07 01:28:34.488-05:00,2023:04:07 01:28:34-05:00,488.0,488.0,"(Binary data 5335 bytes, use -b option to extract)",5335,2720,,[minor] Bad format (16) for MakerNotes entry 10,Auto,72,Centered,YCbCr4:2:0 (2 2),72
6+
tests/fixtures/images/gps_example.JPG,-0.221040815 -0.1778482944 -0.9789179563,1.9,1.9,8,0.1571 0.06657 0.78407,"(Binary data 32 bytes, use -b option to extract)",3.697543924,1.04788 0.02292 -0.0502 0.02959 0.99048 -0.01706 -0.00923 0.01508 0.75168,0.003 mm,"Not Embedded, Independent",3,Uncalibrated,RGB ,"Y, Cb, Cr, -",General Composite Image,JPEG (old-style),0.9642 1 0.82491,2023:04:07 01:28:34,2023:04:07 01:28:34,0.0,0.0,"Reflective, Glossy, Positive, Color",Apple Computer Inc.,,,tests/fixtures/images,"Baseline DCT, Huffman coding","Big-endian (Motorola, MM)",2316,3088,12.4,232,0,Auto,Program AE,1/63,2023:11:13 11:50:57-06:00,2023:11:13 11:17:11-06:00,2023:04:07 01:29:59-05:00,gps_example.JPG,-rwxrwxrwx,2.5 MiB,JPEG,jpg,"Off, Did not fire",100.0,1.9,2.7 mm,2.7 mm (35 mm equivalent: 30.0 mm),30 mm,61.9 deg,369 m Above Sea Level,Above Sea Level,2023:04:07,254.1263885,True North,6202.480122 m,74.12638847,True North,"42 deg 1' 40.21"" N",North,"93 deg 39' 1.52"" W",West,"42 deg 1' 40.21"" N, 93 deg 39' 1.52"" W",0.0,km/h,0.29198 0.69225 0.04189,"(Binary data 32 bytes, use -b option to extract)",iPhone 14 Pro,1.41 m,2316,3088x2316,,3088,80,1.01,iPhone 14 Pro front camera 2.69mm f/1.9,2.690000057mm f/1.9,Apple,iPhone 14 Pro front camera 2.69mm f/1.9,8.2,Apple,,0.96419 1 0.82489,7.2,Multi-segment,image/jpeg,iPhone 14 Pro,2023:04:07 01:28:34,100.0,"(Binary data 76932 bytes, use -b option to extract)",(none),JPEG,76932.0,2503914.0,Undefined,2.0,-05:00,-05:00,-05:00,Rotate 90 CW,Apple Computer Inc.,Display Device Profile,Apple Computer Inc.,XYZ ,"Copyright Apple Inc., 2022",Apple Computer Inc.,2022:01:01 00:00:00,Display P3,acsp,ecfda38e388547c36db4bd4f7ada182f,4.0.0,0.51512 0.2412 -0.00105,"(Binary data 32 bytes, use -b option to extract)",Perceptual,inches,0.0,Valid,1000000000.0,11:02:38,39757691325208.0,11.2,Standard,Directly photographed,One-chip color area,1/63,1/63,16.2,1541 1154 1697 1016,2023:04:07 01:28:34.488-05:00,2023:04:07 01:28:34.488-05:00,2023:04:07 01:28:34-05:00,488.0,488.0,"(Binary data 5335 bytes, use -b option to extract)",5335,2720,,[minor] Bad format (16) for MakerNotes entry 10,Auto,72,Centered,YCbCr4:2:0 (2 2),72
2.46 MB
Loading

tests/test_wrangle.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,3 +106,18 @@ def test_wipe_gps(temp_dir2):
106106
df = wrangle.get_exif(input_dir=str(temp_dir2), output_csv=os.path.join(temp_dir2, 'gps.csv'))
107107
gps_tags = [f for f in df.columns if f.startswith('GPS')]
108108
assert not gps_tags
109+
110+
def test_wipe_gps_file_w_parentheses(temp_dir2):
111+
# copy image with gps data to temp dir
112+
shutil.copy2(os.path.join('tests', 'fixtures', 'images', 'gps_example.JPG'), os.path.join(temp_dir2, 'gps_example (0).JPG'))
113+
# check copied image has GPS tags
114+
df = wrangle.get_exif(input_dir=str(temp_dir2), output_csv=os.path.join(temp_dir2, 'gps.csv'))
115+
gps_tags = [f for f in df.columns if f.startswith('GPS')]
116+
assert gps_tags
117+
118+
# wipe gps
119+
wrangle.wipe_gps(os.path.join(temp_dir2, 'gps_example (0).JPG'))
120+
# check copied image has GPS tags
121+
df = wrangle.get_exif(input_dir=str(temp_dir2), output_csv=os.path.join(temp_dir2, 'gps.csv'))
122+
gps_tags = [f for f in df.columns if f.startswith('GPS')]
123+
assert not gps_tags

0 commit comments

Comments
 (0)