-
Notifications
You must be signed in to change notification settings - Fork 4
/
Get-ExifData.ps1
1479 lines (1247 loc) · 131 KB
/
Get-ExifData.ps1
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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<#
Get-ExifData.ps1
#>
[CmdletBinding()]
Param (
[Parameter(ValueFromPipeline=$true,
ValueFromPipelineByPropertyName=$true,
HelpMessage="`r`nPath: From which folder or directory would you like to check the pictures for their EXIF data? `r`n`r`nPlease enter a valid file system path to a directory (a full path name of a folder such as C:\Windows). `r`n`r`nNotes:`r`n`t- If the path name includes space characters, please enclose the path in quotation marks (single or double). `r`n`t- To exit this script, please press [Ctrl] + C `r`n")]
# [ValidateScript({Test-Path $_ -PathType 'Container'})]
[Alias("Directory","DirectoryPath","Folder","FolderPath")]
[string[]]$Path,
[Parameter(ValueFromPipeline=$true,
ValueFromPipelineByPropertyName=$true,
HelpMessage="`r`nFile: From which single file would you like to check the EXIF data? `r`n`r`nPlease enter a valid full file system path pointing to a file (with a full path name of a folder such as C:\Windows\explorer.exe). `r`n`r`nNotes:`r`n`t- If the path name includes space characters, please enclose the path in quotation marks (single or double). `r`n`t- To exit this script, please press [Ctrl] + C `r`n")]
# [ValidateScript({Test-Path $_ -PathType 'Leaf'})]
[Alias("SourceFile","FilePath","Files")]
[string[]]$File,
[Parameter(HelpMessage="`r`nOutput: In which folder or directory would you like to find the CSV logfile? `r`n`r`nPlease enter a valid file system path to a directory (a full path name of a folder such as C:\Windows). `r`n`r`nNotes:`r`n`t- If the path name includes space characters, please enclose the path in quotation marks (single or double). `r`n")]
[Alias("OutputFolder","LogFileFolder")]
[string]$Output = "$($env:USERPROFILE)\Pictures",
[switch]$Recurse,
[Alias("Silent","NoLog","DoNotCreateALog")]
[switch]$SuppressLog,
[switch]$Open,
[switch]$Force,
[switch]$Audio
)
Begin {
# Function used to convert bytes to MB or GB or TB # Credit: clayman2: "Disk Space"
function ConvertBytes {
Param (
$size
)
If ($size -eq $null) {
[string]'-'
} ElseIf ($size -eq 0) {
[string]'-'
} ElseIf ($size -lt 1MB) {
$file_size = $size / 1KB
$file_size = [Math]::Round($file_size, 0)
[string]$file_size + ' KB'
} ElseIf ($size -lt 1GB) {
$file_size = $size / 1MB
$file_size = [Math]::Round($file_size, 1)
[string]$file_size + ' MB'
} ElseIf ($size -lt 1TB) {
$file_size = $size / 1GB
$file_size = [Math]::Round($file_size, 1)
[string]$file_size + ' GB'
} Else {
$file_size = $size / 1TB
$file_size = [Math]::Round($file_size, 1)
[string]$file_size + ' TB'
} # else
} # function (ConvertBytes)
# Set the common parameters
# Source: http://stackoverflow.com/questions/27175137/powershellv2-remove-last-x-characters-from-a-string
$ErrorActionPreference = "Stop"
$computer = $env:COMPUTERNAME
$log_filename = "exif_log.csv"
$date = Get-Date -Format g
$timestamp = Get-Date -Format yyyyMMdd
$discarded_files = @()
$source_files = @()
$horizontal = @()
$new_files = @()
$vertical = @()
$results = @()
$number_of_paths = $Path.Count
$number_of_files = $File.Count
$index = 0
$num_images = 0
$num_discarded = 0
$path_verbose = "Please consider checking that the source folders '$Path', where the pictures containing EXIF data are supposed to be found (and which are set with the -Path parameter), were typed correctly, and that each of them is a valid file system path pointing to a directory. If a path name includes space characters, please enclose that individual path string in quotation marks (single or double). To enter multiple folderpaths, please separate them with a comma."
$file_verbose = "Please consider checking that the paths to the source files '$File', which is set with the -File parameter, was typed correctly, and that they are valid full file system paths pointing to a file (with a full path name of a folder such as C:\Windows\explorer.exe). If the full filepath includes space characters, please enclose that individual path string in quotation marks (single or double). To enter multiple filepaths, please separate them with a comma."
$empty_line = ""
# Test if the Microsoft Windows Image Acquisition (WIA) service is enabled (used in Step 1)
$test_wia = Get-Service | where { $_.ServiceName -eq "stisvc" } -ErrorAction SilentlyContinue
$wia_startup_type = (Get-WmiObject -Class Win32_Service -ComputerName $computer -Filter "Name='stisvc'").StartMode
If (($test_wia -eq $null) -or ($wia_startup_type -eq 'Disabled')) {
# If the WIA service is not enabled, display an error message in console and exit
$empty_line | Out-String
Write-Warning "The Microsoft Windows Image Acquisition (WIA) service 'stisvc' doesn't seem to be enabled."
$empty_line | Out-String
Write-Verbose "The WIA service is needed for opening and saving the the image files. For futher instructions, how to enable the WIA service, please for example see http://kb.winzip.com/kb/entry/207/ " -verbose
$empty_line | Out-String
$exit_text = "Didn't open any files for further examination (Exit 1)."
Write-Output $exit_text
$empty_line | Out-String
Exit
} Else {
$continue = $true
} # Else (If $test_wia)
# Set Image Swithes (used in Step 2)
# Source: http://nicholasarmstrong.com/2010/02/exif-quick-reference/
# Source: http://msdn.microsoft.com/en-us/library/ms630826%28v=vs.85%29.aspx
# Source: https://sno.phy.queensu.ca/~phil/exiftool/TagNames/EXIF.html
# Source: https://stackoverflow.com/questions/7076958/read-exif-and-determine-if-the-flash-has-fired#7100717
# Credit: Franck Richard: "Use PowerShell to Remove Metadata and Resize Images": http://franckrichard.blogspot.com/2011/04/2011-scripting-games-advanced-event-8.html
$clnfaxdata = @{ 0 = "Clean"; 1 = "Regenerated"; 2 = "Unclean" }
$compress = @{ 1 = 'Uncompressed'; 2 = 'CCITT 1D'; 3 = 'T4/Group 3 Fax'; 4 = 'T6/Group 4 Fax'; 5 = 'LZW'; 6 = 'JPEG (old-style)'; 7 = 'JPEG'; 8 = 'Adobe Deflate'; 9 = 'JBIG B&W'; 10 = 'JBIG Color'; 99 = 'JPEG'; 262 = 'Kodak 262'; 32766 = 'Next'; 32767 = 'Sony ARW Compressed'; 32769 = 'Packed RAW'; 32770 = 'Samsung SRW Compressed'; 32771 = 'CCIRLEW'; 32772 = 'Samsung SRW Compressed 2'; 32773 = 'PackBits'; 32809 = 'Thunderscan'; 32867 = 'Kodak KDC Compressed'; 32895 = 'IT8CTPAD'; 32896 = 'IT8LW'; 32897 = 'IT8MP'; 32898 = 'IT8BL'; 32908 = 'PixarFilm'; 32909 = 'PixarLog'; 32946 = 'Deflate'; 32947 = 'DCS'; 34661 = 'JBIG'; 34676 = 'SGILog'; 34677 = 'SGILog24'; 34712 = 'JPEG 2000'; 34713 = 'Nikon NEF Compressed'; 34715 = 'JBIG2 TIFF FX'; 34718 = 'Microsoft Document Imaging (MDI) Binary Level Codec'; 34719 = 'Microsoft Document Imaging (MDI) Progressive Transform Codec'; 34720 = 'Microsoft Document Imaging (MDI) Vector'; 34892 = 'Lossy JPEG'; 65000 = 'Kodak DCR Compressed'; 65535 = 'Pentax PEF Compressed' }
$contrast = @{ 0 = "Normal"; 1 = "Low"; 2 = "High" }
$custrender = @{ 0 = "Normal process"; 1 = "Custom process"; 3 = "HDR"; 6 = "Panorama"; 8 = "Portrait" }
$exposurem = @{ 0 = "Auto exposure"; 1 = "Manual exposure"; 2 = "Auto Bracket" }
$exposurep = @{ 0 = 'Not defined'; 1 = 'Manual'; 2 = 'Program AE (normal)'; 3 = 'Aperture-priority AE'; 4 = 'Shutter speed priority AE'; 5 = 'Creative (depth of field)'; 6 = 'Action (fast shutter speed)'; 7 = 'Portrait'; 8 = 'Landscape'; 9 = 'Bulb' }
$extrasamp = @{ 0 = "Unspecified"; 1 = "Associated Alpha"; 2 = "Unassociated Alpha" }
$faxprofil = @{ 0 = "Unknown"; 1 = "Minimal B&W lossless, S"; 2 = "Extended B&W lossless, F"; 3 = "Lossless JBIG B&W, J "; 4 = "Lossy color and grayscale, C"; 5 = "Lossless color and grayscale, L"; 6 = "Mixed raster content, M"; 7 = "Profile T"; 255 = "Multi Profiles" }
$filesrc = @{ 1 = "Film scanner"; 2 = "Reflection print scanner"; 3 = "Digital camera" }
$fillord = @{ 1 = "Normal"; 2 = "Reversed" }
$flashvalue = @{ 0 = 'Flash not fired, no flash'; 1 = 'Flash was fired, fired'; 5 = 'Flash was fired, fired, return not detected'; 7 = 'Flash was fired, fired, return detected'; 8 = 'Flash not fired, on, did not fire'; 9 = 'Flash was fired, on, fired'; 13 = 'Flash was fired, on, return not detected'; 15 = 'Flash was fired, on, return detected'; 16 = 'Flash not fired, off, did not fire'; 20 = 'Flash not fired, off, did not fire, return not detected'; 24 = 'Flash not fired, auto, did not fire'; 25 = 'Flash was fired, auto, fired'; 29 = 'Flash was fired, auto, fired, return not detected'; 31 = 'Flash was fired, auto, fired, return detected'; 32 = 'Flash not fired, no flash function'; 48 = 'Flash not fired, off, no flash function'; 65 = 'Flash was fired, fired, red-eye reduction'; 69 = 'Flash was fired, fired, red-eye reduction, return not detected'; 71 = 'Flash was fired, fired, red-eye reduction, return detected'; 73 = 'Flash was fired, on, red-eye reduction'; 77 = 'Flash was fired, on, red-eye reduction, return not detected'; 79 = 'Flash was fired, on, red-eye reduction, return detected'; 80 = 'Flash not fired, off, red-eye reduction'; 88 = 'Flash not fired, auto, did not fire, red-eye reduction'; 89 = 'Flash was fired, auto, fired, red-eye reduction'; 93 = 'Flash was fired, auto, fired, red-eye reduction, return not detected'; 95 = 'Flash was fired, auto, fired, red-eye reduction, return detected' }
$focal = @{ 1 = "None"; 2 = "Inches"; 3 = "Centimetres" ; 4 = "Millimetres"; 5 = "Micrometres" }
$focalprun = @{ 1 = "None"; 2 = "Inches"; 3 = "cm" ; 4 = "mm"; 5 = "Micrometres" }
$gain = @{ 0 = "None"; 1 = "Low gain up"; 2 = "High gain up"; 3 = "Low gain down"; 4 = "High gain down" }
$gpsaltref = @{ 0 = "Above sea level"; 1 = "Below sea level" }
$gpsdiffer = @{ 0 = "No correction"; 1 = "Differential correction applied" }
$gpsdirect = @{ M = "Magnetic North"; T = "True North" }
$gpsdistrf = @{ K = "Kilometers"; M = "Miles"; N = "Nautical Miles" }
$gpsmeasure = @{ 2 = "2-Dimensional Measurement"; 3 = "3-Dimensional Measurement" }
$gpsspeedrf = @{ K = "km/h"; M = "mph"; N = "knots" }
$gpsstat = @{ A = "Measurement Active"; V = "Measurement Void" }
$grayrespun = @{ 1 = '0.1'; 2 = '0.001'; 3 = '0.0001'; 4 = '0.00001'; 5 = '0.000001' }
$incst = @{ 1 = "CMYK"; 2 = "Not CMYK" }
$indexd = @{ 0 = "Not indexed"; 1 = "Indexed" }
$jpegpro = @{ 1 = "Baseline"; 14 = "Lossless" }
$lightsrc = @{ 0 = 'Unknown'; 1 = 'Daylight'; 2 = 'Fluorescent'; 3 = 'Tungsten (Incandescent)'; 4 = 'Flash'; 9 = 'Fine Weather'; 10 = 'Cloudy'; 11 = 'Shade'; 12 = 'Daylight Fluorescent (D 5700 - 7100K)'; 13 = 'Day White Fluorescent (N 4600 - 5500K)'; 14 = 'Cool White Fluorescent (W 3800 - 4500K)'; 15 = 'White Fluorescent (WW 3250 - 3800K)'; 16 = 'Warm White Fluorescent (L 2600 - 3250K)'; 17 = 'Standard Light A'; 18 = 'Standard Light B'; 19 = 'Standard Light C'; 20 = 'D55'; 21 = 'D65'; 22 = 'D75'; 23 = 'D50'; 24 = 'ISO Studio Tungsten'; 255 = 'Other' }
$metering = @{ 0 = "Unknown"; 1 = "Average"; 2 = "Center-weighted average"; 3 = "Spot"; 4 = "Multi-spot"; 5 = "Multi-segment"; 6 = "Partial"; 255 = "Other" }
$opiprox = @{ 0 = "Higher resolution image does not exist"; 1 = "Higher resolution image exists" }
$orient = @{ 1 = "Horizontal"; 2 = "Mirror horizontal"; 3 = "Rotate 180 degrees"; 4 = "Mirror vertical"; 5 = "Mirror horizontal and rotate 270 degrees clockwise"; 6 = "Rotate 90 degrees clockwise"; 7 = "Mirror horizontal and rotate 90 degrees clockwise"; 8 = "Rotate 270 degrees clockwise" }
$photmtrint = @{ 0 = 'WhiteIsZero'; 1 = 'BlackIsZero'; 2 = 'RGB'; 3 = 'RGB Palette'; 4 = 'Transparency Mask'; 5 = 'CMYK'; 6 = 'YCbCr'; 8 = 'CIELab'; 9 = 'ICCLab'; 10 = 'ITULab'; 32803 = 'Color Filter Array'; 32844 = 'Pixar LogL'; 32845 = 'Pixar LogLuv'; 34892 = 'Linear Raw' }
$planarconf = @{ 1 = "Chunky"; 2 = "Planar" }
$predict = @{ 1 = "None"; 2 = "Horizontal differencing" }
$previewcol = @{ 0 = "Unknown"; 1 = "Gray Gamma 2.2"; 2 = "sRGB"; 3 = "Adobe RGB"; 4 = "ProPhoto RGB" }
$profiletyp = @{ 0 = "Unspecified"; 1 = "Group 3 FAX" }
$saturation = @{ 0 = "Normal"; 1 = "Low saturation"; 2 = "High saturation" }
$scene = @{ 0 = "Standard"; 1 = "Landscape"; 2 = "Portrait"; 3 = "Night" }
$securitycl = @{ C = "Confidential"; R = "Restricted"; S = "Secret"; T = "Top Secret"; U = "Unclassified" }
$sensing = @{ 1 = "Not defined"; 2 = "One-chip colour area"; 3 = "Two-chip colour area" ; 4 = "Three-chip colour area"; 5 = "Colour sequential area"; 7 = "Trilinear"; 8 = "Colour sequential linear" }
$sensittyp = @{ 0 = "Unknown"; 1 = "Standard Output Sensitivity"; 2 = "Recommended Exposure Index"; 3 = "ISO Speed" ; 4 = "Standard Output Sensitivity and Recommended Exposure Index"; 5 = "Standard Output Sensitivity and ISO Speed"; 6 = "Recommended Exposure Index and ISO Speed"; 7 = "Standard Output Sensitivity, Recommended Exposure Index and ISO Speed" }
$sensmethod = @{ 1 = "Monochrome area"; 2 = "One-chip colour area"; 3 = "Two-chip colour area" ; 4 = "Three-chip colour area"; 5 = "Colour sequential area"; 6 = "Monochrome linear"; 7 = "Trilinear"; 8 = "Colour sequential linear" }
$sharpness = @{ 0 = "Normal"; 1 = "Soft"; 2 = "Hard" }
$subfiletyp = @{ 1 = "Full-resolution image"; 2 = "Reduced-resolution image"; 3 = "Single page of multi-page image" }
$subjdist = @{ 0 = "Unknown"; 1 = "Macro"; 2 = "Close" ; 3 = "Distant" }
$threshold = @{ 1 = "No dithering or halftoning"; 2 = "Ordered dither or halftone"; 3 = "Randomized dither" }
$unit = @{ 1 = "None"; 2 = "Inches"; 3 = "Centimetres" }
$white = @{ 0 = "Auto white balance"; 1 = "Manual white balance" }
$ycbcrpos = @{ 1 = "Centered"; 2 = "Co-sited" }
# Display a welcome message in console
If ($number_of_files -gt 1) {
$file_word = "files"
} ElseIf ($number_of_files -eq 1) {
$file_word = "file"
} Else {
$continue = $true
} # Else ($number_of_files -gt 1)
If ($number_of_paths -gt 1 -and -not $Recurse) {
$folder_word = "folders"
} ElseIf ($number_of_paths -eq 1 -and -not $Recurse) {
$folder_word = "folder"
} ElseIf ($number_of_paths -gt 1 -and $Recurse) {
$folder_word = "folders recursively"
} ElseIf ($number_of_paths -eq 1 -and $Recurse) {
$folder_word = "folder recursively"
} Else {
$continue = $true
} # Else ($number_of_paths -gt 1)
If (-not $Path -and -not $File) {
$welcome_text = "Searching for image files at the default -Path $($env:USERPROFILE)\Pictures"
} ElseIf ($Path -and -not $File) {
$welcome_text = "Searching for image files at $number_of_paths $folder_word"
} ElseIf (-not $Path -and $File) {
$welcome_text = "Reading $number_of_files image $file_word."
} ElseIf ($Path -and $File) {
$welcome_text = "Searching for image files at $number_of_paths $folder_word and reading additional $number_of_files image $file_word."
} Else {
$welcome_text = ""
} # Else (-not $Path -and -not $File)
$empty_line | Out-String
Write-Output $welcome_text
# Try to enumerate the files inputted trough the $File parameter
If ($File) {
ForEach ($file_candidate in $File) {
If ((Test-Path $file_candidate -PathType 'Leaf') -eq $true) {
# Add the individual filepath in question to the list of files to be processed further
$new_files += Get-ChildItem -Path $file_candidate -Force -ErrorAction SilentlyContinue
} ElseIf ((Test-Path $file_candidate -PathType 'Container') -eq $true) {
# A directory is inputted through the $File parameter
$empty_line | Out-String
Write-Warning "-File: '$file_candidate' seems to be a directory."
$empty_line | Out-String
Write-Verbose "For checking the EXIF data on files inside a folder, please consider using the -Path parameter instead of the -File parameter." -verbose
$empty_line | Out-String
Exit
} ElseIf ((Test-Path $file_candidate) -eq $false) {
# A non-existing file is inputted through the $File parameter
$empty_line | Out-String
Write-Warning "-File: '$file_candidate' doesn't seem to exist."
$empty_line | Out-String
Write-Verbose $file_verbose -verbose
$empty_line | Out-String
Exit
} Else {
$continue = $true
} # Else (If Test-Path $file_candidate -PathType 'Leaf')
} # ForEach $file_candidate in $File
} Else {
$continue = $true
} # Else (If $File)
# Try to enumerate the folders inputted trough the $Path parameter
If ($Path) {
ForEach ($path_candidate in $Path) {
If ((Test-Path $path_candidate -PathType 'Container') -eq $true) {
# Omit the last character, if it's \
# Source: http://stackoverflow.com/questions/27175137/powershellv2-remove-last-x-characters-from-a-string#32608908
If ((($path_candidate).EndsWith("\")) -eq $true) { $path_candidate = $path_candidate -replace ".{1}$" } Else { $continue = $true }
# Add the files inside the folders to the list of files to be processed further according to the recursive setting
If ($Recurse) {
$new_files += Get-ChildItem -Path $path_candidate -Recurse -Force -ErrorAction SilentlyContinue | where { $_.PsIsContainer -eq $false }
} Else {
$new_files += Get-ChildItem -Path $path_candidate -Force -ErrorAction SilentlyContinue | where { $_.PsIsContainer -eq $false }
} # Else If $Recurse
} ElseIf ((Test-Path $path_candidate -PathType 'Leaf') -eq $true) {
# A file is inputted through the $Path parameter
$empty_line | Out-String
Write-Warning "-Path: '$path_candidate' seems to be a file."
$empty_line | Out-String
Write-Verbose "For checking the EXIF data on individual files, please consider using the -File parameter instead of the -Path parameter." -verbose
$empty_line | Out-String
Exit
} ElseIf ((Test-Path $path_candidate) -eq $false) {
# A non-existing folder is inputted through the $Path parameter
$empty_line | Out-String
Write-Warning "-Path: '$path_candidate' doesn't seem to exist."
$empty_line | Out-String
Write-Verbose $path_verbose -verbose
$empty_line | Out-String
Exit
} Else {
$continue = $true
} # Else (If Test-Path $path_candidate -PathType 'Container')
} # ForEach $path_candidate in $Path
} Else {
$continue = $true
} # Else (If $Path)
# Try to find something if no source is specified
If ( -not $File -and -not $Path ) {
$Path = "$($env:USERPROFILE)\Pictures"
If ((Test-Path $Path -PathType 'Container') -eq $true) {
# Add the files inside the folders to the list of files to be processed further according to the recursive setting
If ($Recurse) {
$new_files += Get-ChildItem -Path $Path -Recurse -Force -ErrorAction SilentlyContinue | where { $_.PsIsContainer -eq $false }
} Else {
$new_files += Get-ChildItem -Path $Path -Force -ErrorAction SilentlyContinue | where { $_.PsIsContainer -eq $false }
} # Else If $Recurse
} Else {
$continue = $true
} # Else (If Test-Path $Path -PathType 'Container')
} Else {
$continue = $true
} # Else (If -not $File -and -not $Path)
# Filter the image files
# The Select-Object -Unique may slow the process down quite considerably...
# $unique_files = $new_files | Select-Object -Unique
# ForEach ($item in $unique_files) {
ForEach ($item in $new_files) {
If ( (([System.IO.FileInfo]"$item").Extension) -like ".3FR" -or
(([System.IO.FileInfo]"$item").Extension) -like ".ARW" -or
(([System.IO.FileInfo]"$item").Extension) -like ".BMP" -or
(([System.IO.FileInfo]"$item").Extension) -like ".CR2" -or
(([System.IO.FileInfo]"$item").Extension) -like ".CR3" -or
(([System.IO.FileInfo]"$item").Extension) -like ".CRW" -or
(([System.IO.FileInfo]"$item").Extension) -like ".DNG" -or
(([System.IO.FileInfo]"$item").Extension) -like ".EPS" -or
(([System.IO.FileInfo]"$item").Extension) -like ".GIF" -or
(([System.IO.FileInfo]"$item").Extension) -like ".JP2" -or
(([System.IO.FileInfo]"$item").Extension) -like ".JPEG" -or
(([System.IO.FileInfo]"$item").Extension) -like ".JPG" -or
(([System.IO.FileInfo]"$item").Extension) -like ".MDC" -or
(([System.IO.FileInfo]"$item").Extension) -like ".MRW" -or
(([System.IO.FileInfo]"$item").Extension) -like ".NEF" -or
(([System.IO.FileInfo]"$item").Extension) -like ".NRW" -or
(([System.IO.FileInfo]"$item").Extension) -like ".ORF" -or
(([System.IO.FileInfo]"$item").Extension) -like ".PCT" -or
(([System.IO.FileInfo]"$item").Extension) -like ".PEF" -or
(([System.IO.FileInfo]"$item").Extension) -like ".PGF" -or
(([System.IO.FileInfo]"$item").Extension) -like ".PNG" -or
(([System.IO.FileInfo]"$item").Extension) -like ".PSD" -or
(([System.IO.FileInfo]"$item").Extension) -like ".PTX" -or
(([System.IO.FileInfo]"$item").Extension) -like ".R3D" -or
(([System.IO.FileInfo]"$item").Extension) -like ".RAF" -or
(([System.IO.FileInfo]"$item").Extension) -like ".RAW" -or
(([System.IO.FileInfo]"$item").Extension) -like ".RW2" -or
(([System.IO.FileInfo]"$item").Extension) -like ".RWL" -or
(([System.IO.FileInfo]"$item").Extension) -like ".SR2" -or
(([System.IO.FileInfo]"$item").Extension) -like ".SRF" -or
(([System.IO.FileInfo]"$item").Extension) -like ".SRW" -or
(([System.IO.FileInfo]"$item").Extension) -like ".TIF" -or
(([System.IO.FileInfo]"$item").Extension) -like ".TIFF" -or
(([System.IO.FileInfo]"$item").Extension) -like ".X3F" -or
(([System.IO.FileInfo]"$item").Extension) -like ".XMP" ) {
$num_images++
$source_files += Get-ChildItem -Path $item.FullName -Force -ErrorAction SilentlyContinue
} Else {
$num_discarded++
$discarded_files += Get-ChildItem -Path $item.FullName -Force -ErrorAction SilentlyContinue
} # Else (If (([System.IO.FileInfo]"$item").Extension) -like)
} # ForEach $item in $new_files
# Set the progress bar variables ($id denominates different progress bars, if more than one is being displayed)
$activity = "Processing $($source_files.Count) image files"
$status = " "
$task = "Setting Initial Variables"
$operations = (($source_files.Count) + 2)
$total_steps = (($source_files.Count) + 3)
$task_number = 0
$id = 1
# Start the progress bar if there is more than one unique file to process, and halt the procedure if it seems that there's nothing to do
If (($source_files.Count) -ge 2) {
Write-Progress -Id $id -Activity $activity -Status $status -CurrentOperation $task -PercentComplete ((0.000002 / $total_steps) * 100)
} ElseIf (($source_files.Count) -lt 1) {
$empty_line | Out-String
$text = "Didn't find any image files (Exit 2)."
Write-Output $text
$empty_line | Out-String
Exit
} Else {
$continue = $true
} # If ($source_files.Count)
# Test if the Output-path -LogFileFolder exists
If ((Test-Path $Output -PathType Leaf) -eq $true) {
# File: Display an error message in console and exit
$empty_line | Out-String
Write-Warning "-Output: '$Output' seems to point to a file."
$empty_line | Out-String
$exit_text = "Couldn't open the -Output folder '$Output' since it's a file (Exit 3)."
Write-Output $exit_text
$empty_line | Out-String
Exit
} ElseIf ((Test-Path $Output) -eq $false) {
If ($Force) {
# If the Force was used, create the destination folder ($Output)
New-Item "$Output" -ItemType Directory -Force | Out-Null
$continue = $true
} Else {
# No Destination: Display an error message in console
$empty_line | Out-String
Write-Warning "-Output: '$Output' doesn't seem to exist."
# Offer the user an option to create the defined $Output -LogFileFolder # Credit: lamaar75: "Creating a Menu": http://powershell.com/cs/forums/t/9685.aspx
# Source: "Adding a Simple Menu to a Windows PowerShell Script": https://technet.microsoft.com/en-us/library/ff730939.aspx
$title_corner = "Create folder '$Output' with this script?"
$message = " "
$yes = New-Object System.Management.Automation.Host.ChoiceDescription "&Yes", "Yes: tries to create a new folder and to write the CSV logfile there."
$no = New-Object System.Management.Automation.Host.ChoiceDescription "&No", "No: exits from this script (similar to Ctrl + C)."
$exit = New-Object System.Management.Automation.Host.ChoiceDescription "&Exit", "Exit: exits from this script (similar to Ctrl + C)."
$abort = New-Object System.Management.Automation.Host.ChoiceDescription "&Abort", "Abort: exits from this script (similar to Ctrl + C)."
$cancel = New-Object System.Management.Automation.Host.ChoiceDescription "&Cancel", "Cancel: exits from this script (similar to Ctrl + C)."
$options = [System.Management.Automation.Host.ChoiceDescription[]]($yes, $no, $exit, $abort, $cancel)
$choice_result = $host.ui.PromptForChoice($title_corner, $message, $options, 1)
switch ($choice_result)
{
0 {
"Yes. Creating the folder.";
New-Item "$Output" -ItemType Directory -Force | Out-Null
$continue = $true
}
1 {
$empty_line | Out-String
"No. Exiting from EXIF data retrieval script.";
$empty_line | Out-String
Exit
}
2 {
$empty_line | Out-String
"Exit. Exiting from EXIF data retrieval script.";
$empty_line | Out-String
Exit
}
3 {
$empty_line | Out-String
"Abort. Exiting from EXIF data retrieval script.";
$empty_line | Out-String
Exit
}
4 {
$empty_line | Out-String
"Cancel. Exiting from EXIF data retrieval script.";
$empty_line | Out-String
Exit
} # 4
} # switch
} # Else If $Force)
} Else {
$continue = $true
} # Else (Test-Path $Output -PathType Leaf)
# Resolve the Output-path ("Destination") (if the Output-path is specified as relative) and remove the last character if it's \
# Source: https://technet.microsoft.com/en-us/library/ee692804.aspx
# Source: http://stackoverflow.com/questions/27175137/powershellv2-remove-last-x-characters-from-a-string#32608908
$real_output_path = (Resolve-Path -Path $Output).Path
If ((($real_output_path).EndsWith("\")) -eq $true) { $real_output_path = $real_output_path -replace ".{1}$" }
} # Begin
Process {
# Process each image
$image = New-Object -ComObject WIA.ImageFile
ForEach ($picture in $source_files) {
# Increment the step counters and reset the comment section ($remarks)
$remarks = @()
$task_number++
$index++
# Update the progress bar if there is more than one unique file to process
$activity = "Processing $($source_files.Count) image files - Step $task_number/$operations"
If (($source_files.Count) -ge 2) {
Write-Progress -Id $id -Activity $activity -Status $status -CurrentOperation $picture.Name -PercentComplete (($task_number / $total_steps) * 100)
} # If ($source_files.Count)
# Step 1
# Load the image as an ImageFile COM object with Microsoft Windows Image Acquisition (WIA)
# Note: To edit the image: WIA.ImageProcess... $ip = New-Object -ComObject WIA.ImageProcess ... $ip.FilterInfos | fl *
# Note: For data retriaval also: System.Drawing.Image.PropertyItems
# Note: In the default installations of Windows Server 2003 and 2012 the Windows Image Acquisition (WIA) service is not enabled by default.
# Note: On Windows Server 2008 the WIA service is not installed by default. To add this feature, please see the WinZip Knowledgebase link below.
# Source: http://kb.winzip.com/kb/entry/207/
# Source: https://msdn.microsoft.com/en-us/library/windows/desktop/ms630506(v=vs.85).aspx
# Source: https://blogs.msdn.microsoft.com/powershell/2009/03/30/image-manipulation-in-powershell/
# Source: http://stackoverflow.com/questions/4304821/get-startup-type-of-windows-service-using-powershell
# Source: https://msdn.microsoft.com/en-us/powershell/reference/5.1/microsoft.powershell.management/get-wmiobject
# Source: https://social.microsoft.com/Forums/en-US/4dfe4eec-2b9b-4e6e-a49e-96f5a108c1c8/using-powershell-as-a-photoshop-replacement?forum=Offtopic
# $disabled_wia = Get-WmiObject -Class Win32_Service -ComputerName $computer -Filter "Name='stisvc'" | Where-Object { $_.StartMode -eq 'Disabled' }
# $test_wia = Get-Service | where {$_.DisplayName -like "*Windows Image Acquisition*" } -ErrorAction SilentlyContinue
# $name = dir "C:\Users\Juha\Pictures\3.JPG" | select -ExpandProperty FullName
# $name = dir "C:\Users\Juha\Pictures\philips_B21091H_A.jpg" | select -ExpandProperty FullName
# $name = dir "C:\Temp\upload\fDSCN0433.JPG" | select -ExpandProperty FullName
$name = $picture | select -ExpandProperty FullName
$image.LoadFile($name)
# Determine the picture orientation
If (($image.Width -ge "320") -and ($image.Width -gt $image.Height)) {
$type = "Landscape"
$orientation = "Horizontal"
$horizontal += "$name"
} ElseIf (($image.Height -ge "320") -and ($image.Height -gt $image.Width)) {
$type = "Portrait"
$orientation = "Vertical"
$vertical += "$name"
} Else {
$continue = $true
} # Else (If $image.Width)
# Step 2
# Retrieve image properties (n ~360)
# Source: https://msdn.microsoft.com/en-us/library/ms630826(VS.85).aspx#SharedSample012
If ($image.IsIndexedPixelFormat -eq $true ) { $remarks += "Pixel data contains palette indexes" } Else { $continue = $true }
If ($image.IsAlphaPixelFormat -eq $true ) { $remarks += "Pixel data has alpha information" } Else { $continue = $true }
If ($image.IsExtendedPixelFormat -eq $true ) { $remarks += "Pixel data has extended color information (16 bit/channel)" } Else { $continue = $true }
If ($image.IsAnimated -eq $true ) { $remarks += "Image is animated" } Else { $continue = $true }
# Get SHA256
Try {
If (($PSVersionTable.PSVersion).Major -ge 4) {
# Requires PowerShell version 4.0
# Source: https://msdn.microsoft.com/en-us/powershell/reference/5.1/microsoft.powershell.utility/get-filehash
$hash = Get-FileHash -Path $name -Algorithm SHA256 | Select-Object -ExpandProperty Hash
} Else {
# Get SHA256 hash value in PowerShell version 2 regardless whether it is opened in another program or not
# Requires .NET Framework v3.5
# Source: http://stackoverflow.com/questions/21252824/how-do-i-get-powershell-4-cmdlets-such-as-test-netconnection-to-work-on-windows
# Source: https://msdn.microsoft.com/en-us/library/system.security.cryptography.sha256cryptoserviceprovider(v=vs.110).aspx
# Source: http://stackoverflow.com/questions/21252824/how-do-i-get-powershell-4-cmdlets-such-as-test-netconnection-to-work-on-windows
# Credit: Twon of An: "Get the SHA1,SHA256,SHA384,SHA512,MD5 or RIPEMD160 hash of a file" https://community.spiceworks.com/scripts/show/2263-get-the-sha1-sha256-sha384-sha512-md5-or-ripemd160-hash-of-a-file
# Credit: Gisli: "Unable to read an open file with binary reader" http://stackoverflow.com/questions/8711564/unable-to-read-an-open-file-with-binary-reader
# SHA256 (PowerShell v2)
$SHA256 = New-Object -TypeName System.Security.Cryptography.SHA256CryptoServiceProvider
$source_file_b = [System.IO.File]::Open("$name", [System.IO.Filemode]::Open, [System.IO.FileAccess]::Read, [System.IO.FileShare]::ReadWrite)
$hash = [System.BitConverter]::ToString($SHA256.ComputeHash($source_file_b)) -replace "-",""
$source_file_b.Close()
} # Else (If $PSVersionTable.PSVersion)
} Catch { Write-Debug $_.Exception }
# Source: https://www.experts-exchange.com/questions/25100459/I-need-to-send-the-details-of-a-jpg-file-to-an-array-any-windows-api-to-do-this-or-get-me-started.html
# Source: https://social.technet.microsoft.com/Forums/windowsserver/en-US/16124c53-4c7f-41f2-9a56-7808198e102a/attribute-seems-to-give-byte-array-how-to-convert-to-string?forum=winserverpowershell
# Source: http://compgroups.net/comp.databases.ms-access/handy-routine-for-getting-file-metad/1484921
# GPSProcessingMethod
If ($image.Properties.Exists('27') -and $image.Properties.Item('27').Type -eq 1100) {
$gpsproc = (($image.Properties.Item('27')).Value | ForEach-Object { [System.Text.Encoding]::ASCII.GetString($_) }) -join ("") }
ElseIf ($image.Properties.Exists('27') -and $image.Properties.Item('27').Type -eq 1002) {
$gpsproc = $image.Properties.Item('27').Value } Else { $continue = $true }
# GPSAreaInformation
If ($image.Properties.Exists('28') -and $image.Properties.Item('28').Type -eq 1100) {
$gpsarea = (($image.Properties.Item('28')).Value | ForEach-Object { [System.Text.Encoding]::ASCII.GetString($_) }) -join ("") }
ElseIf ($image.Properties.Exists('28') -and $image.Properties.Item('28').Type -eq 1002) {
$gpsarea = $image.Properties.Item('28').Value } Else { $continue = $true }
# UserComment
If ($image.Properties.Exists('37510') -and $image.Properties.Item('37510').Type -eq 1100) {
$usercomment = (($image.Properties.Item('37510')).Value | ForEach-Object { [System.Text.Encoding]::ASCII.GetString($_) }) -join ("") }
ElseIf ($image.Properties.Exists('37510') -and $image.Properties.Item('37510').Type -eq 1002) {
$usercomment = $image.Properties.Item('37510').Value } Else { $continue = $true }
# XPTitle
If ($image.Properties.Exists('40091')) {
$title = (($image.Properties.Item('40091')).Value | ForEach-Object { [System.Text.Encoding]::ASCII.GetString($_) }) -join ("") } Else { $continue = $true }
# XPComment
If ($image.Properties.Exists('40092')) {
$comment = (($image.Properties.Item('40092')).Value | ForEach-Object { [System.Text.Encoding]::ASCII.GetString($_) }) -join ("") } Else { $continue = $true }
# XPAuthor
If ($image.Properties.Exists('40093')) {
$author = (($image.Properties.Item('40093')).Value | ForEach-Object { [System.Text.Encoding]::ASCII.GetString($_) }) -join ("") } Else { $continue = $true }
# XPKeywords
If ($image.Properties.Exists('40094')) {
$keywords = (($image.Properties.Item('40094')).Value | ForEach-Object { [System.Text.Encoding]::ASCII.GetString($_) }) -join ("") } Else { $continue = $true }
# XPSubject
If ($image.Properties.Exists('40095')) {
$subject = (($image.Properties.Item('40095')).Value | ForEach-Object { [System.Text.Encoding]::ASCII.GetString($_) }) -join ("") } Else { $continue = $true }
# ExifVersion
If ($image.Properties.Exists('36864')) {
$ExifVer = (($image.Properties.Item('36864')).Value | ForEach-Object { [System.Text.Encoding]::ASCII.GetString($_) }) -join ("") } Else { $continue = $true }
# FlashpixVersion
If ($image.Properties.Exists('40960')) {
$FlashpixVer = (($image.Properties.Item('40960')).Value | ForEach-Object { [System.Text.Encoding]::ASCII.GetString($_) }) -join ("") } Else { $continue = $true }
# Reading MakerNote EXIF data (camera maker specific information) requires decoding proprietary code, which has been compiled with different parameters by each vendor
# c.f. https://stackoverflow.com/questions/26696074/read-makernote-exif-tag-in-c-sharp
# c.f. http://tawbaware.com/990exif.htm
# c.f. http://www.burren.cx/david/canon.html
# Source: https://sno.phy.queensu.ca/~phil/exiftool/TagNames/EXIF.html Tag ID: 0x927c
# If ($image.Properties.Exists('37500')) {
# $MakerNote = (($image.Properties.Item('37500')).Value | ForEach-Object { [System.Text.Encoding]::ASCII.GetString($_) }) -join ("") } Else { $continue = $true }
$results += $obj_file = New-Object -TypeName PSCustomObject -Property @{
'Accessed' = $picture.LastAccessTime
'Accessed (UTC)' = $picture.LastAccessTimeUtc
'ActiveFrame' = $image.ActiveFrame
'Aspect Ratio' = [math]::round(($image.Width / $image.Height), 4)
'Attributes' = $picture | select -ExpandProperty Attributes
'BaseName' = $picture.BaseName
# 'File Name Without Extension' = $picture.BaseName
'Comments' = ($picture | select -ExpandProperty VersionInfo).Comments
'CompanyName' = ($picture | select -ExpandProperty VersionInfo).CompanyName
'Created' = $picture.CreationTime
'Created (UTC)' = $picture.CreationTimeUtc
'Directory' = $picture.Directory
'DirectoryName' = $picture | select -ExpandProperty DirectoryName
'File' = $picture.Name
'FileExtension' = $image.FileExtension
'Folder' = ($picture | select -ExpandProperty Directory).Name
'FormatID' = $image.FormatID
'FrameCount' = $image.FrameCount
'Height' = $image.Height
'Home' = $picture.FullName
'HorizontalResolution' = $image.HorizontalResolution
'Index' = $index
'IsAlphaPixelFormat' = $image.IsAlphaPixelFormat
'IsAnimated' = $image.IsAnimated
'IsExtendedPixelFormat' = $image.IsExtendedPixelFormat
'IsIndexedPixelFormat' = $image.IsIndexedPixelFormat
'IsPreRelease' = ($picture | select -ExpandProperty VersionInfo).IsPreRelease
'IsReadOnly' = $picture | select -ExpandProperty IsReadOnly
'IsSpecialBuild' = ($picture | select -ExpandProperty VersionInfo).IsSpecialBuild
'LegalCopyright' = ($picture | select -ExpandProperty VersionInfo).LegalCopyright
'LegalTrademarks' = ($picture | select -ExpandProperty VersionInfo).LegalTrademarks
'Log Date' = $date
'Modified' = $picture.LastWriteTime
'Modified (UTC)' = $picture.LastWriteTimeUtc
'Orientation' = $orientation
'Original File Extension' = $picture.Extension
'PixelDepth' = $image.PixelDepth
'raw_size' = $picture.Length
'Remarks' = ($remarks -join ', ')
'SHA256' = $hash
'Size' = (ConvertBytes ($picture.Length))
'Source' = $name
'Type' = $type
'VerticalResolution' = $image.VerticalResolution
'Width' = $image.Width
# Source: https://www.experts-exchange.com/questions/25100459/I-need-to-send-the-details-of-a-jpg-file-to-an-array-any-windows-api-to-do-this-or-get-me-started.html
'Author' = If ($image.Properties.Exists('40093')) { $author } Else {" "}
'Comment' = If ($image.Properties.Exists('40092')) { $comment } Else {" "}
'Keywords' = If ($image.Properties.Exists('40094')) { $keywords } Else {" "}
'Subject' = If ($image.Properties.Exists('40095')) { $subject } Else {" "}
'Title' = If ($image.Properties.Exists('40091')) { $title } Else {" "}
# Source: http://www.exiv2.org/tags.html
# Source: https://sno.phy.queensu.ca/~phil/exiftool/TagNames/GPS.html
'ActiveArea' = If ($image.Properties.Exists('50829')) { $image.Properties.Item('50829').Value } Else {" "}
'AnalogBalance' = If ($image.Properties.Exists('50727')) { $image.Properties.Item('50727').Value } Else {" "}
'AntiAliasStrength' = If ($image.Properties.Exists('50738')) { $image.Properties.Item('50738').Value } Else {" "}
'Artist' = If ($image.Properties.Exists('315')) { $image.Properties.Item('315').Value } Else {" "}
'AsShotICCProfile' = If ($image.Properties.Exists('50831')) { $image.Properties.Item('50831').Value } Else {" "}
'AsShotNeutral' = If ($image.Properties.Exists('50728')) { $image.Properties.Item('50728').Value } Else {" "}
'AsShotPreProfileMatrix' = If ($image.Properties.Exists('50832')) { $image.Properties.Item('50832').Value } Else {" "}
'AsShotWhiteXY' = If ($image.Properties.Exists('50729')) { $image.Properties.Item('50729').Value } Else {" "}
'BaselineExposure' = If ($image.Properties.Exists('50730')) { $image.Properties.Item('50730').Value } Else {" "}
'BaselineNoise' = If ($image.Properties.Exists('50731')) { $image.Properties.Item('50731').Value } Else {" "}
'BaselineSharpness' = If ($image.Properties.Exists('50732')) { $image.Properties.Item('50732').Value } Else {" "}
'BatteryLevel' = If ($image.Properties.Exists('33423')) { $image.Properties.Item('33423').Value } Else {" "}
'BayerGreenSplit' = If ($image.Properties.Exists('50733')) { $image.Properties.Item('50733').Value } Else {" "}
'BestQualityScale' = If ($image.Properties.Exists('50780')) { $image.Properties.Item('50780').Value } Else {" "}
'BitsPerSample' = If ($image.Properties.Exists('258')) { $image.Properties.Item('258').Value } Else {" "}
'BlackLevel' = If ($image.Properties.Exists('50714')) { $image.Properties.Item('50714').Value } Else {" "}
'BlackLevelDeltaH' = If ($image.Properties.Exists('50715')) { $image.Properties.Item('50715').Value } Else {" "}
'BlackLevelDeltaV' = If ($image.Properties.Exists('50716')) { $image.Properties.Item('50716').Value } Else {" "}
'BlackLevelRepeatDim' = If ($image.Properties.Exists('50713')) { $image.Properties.Item('50713').Value } Else {" "}
'BodySerialNumber' = If ($image.Properties.Exists('42033')) { $image.Properties.Item('42033').Value } Else {" "}
'BrightnessValue' = If ($image.Properties.Exists('37379')) { $image.Properties.Item('37379').Value } Else {" "}
'Byte_AsShotProfileName' = If ($image.Properties.Exists('50934')) { $image.Properties.Item('50934').Value } Else {" "}
'Byte_CameraCalibrationSignat' = If ($image.Properties.Exists('50931')) { $image.Properties.Item('50931').Value } Else {" "}
'Byte_CFAPattern' = If ($image.Properties.Exists('33422')) { $image.Properties.Item('33422').Value } Else {" "}
'Byte_CFAPlaneColor' = If ($image.Properties.Exists('50710')) { $image.Properties.Item('50710').Value } Else {" "}
'Byte_ClipPath' = If ($image.Properties.Exists('343')) { $image.Properties.Item('343').Value } Else {" "}
'Byte_DNGBackwardVersion' = If ($image.Properties.Exists('50707')) { $image.Properties.Item('50707').Value } Else {" "}
'Byte_DNGPrivateData' = If ($image.Properties.Exists('50740')) { $image.Properties.Item('50740').Value } Else {" "}
'Byte_DNGVersion' = If ($image.Properties.Exists('50706')) { $image.Properties.Item('50706').Value } Else {" "}
'Byte_DotRange' = If ($image.Properties.Exists('336')) { $image.Properties.Item('336').Value } Else {" "}
'Byte_GPSAltitudeRef' = If ($image.Properties.Exists('5')) { $gpsaltref[[int]$image.Properties.Item('5').Value] } Else {" "}
'Byte_GPSVersionID' = If ($image.Properties.Exists('0')) { ($image.Properties.Item('0').Value) -join ('.') } Else {" "}
'Byte_ImageResources' = If ($image.Properties.Exists('34377')) { $image.Properties.Item('34377').Value } Else {" "}
'Byte_LocalizedCameraModel' = If ($image.Properties.Exists('50709')) { $image.Properties.Item('50709').Value } Else {" "}
'Byte_OriginalRawFileName' = If ($image.Properties.Exists('50827')) { $image.Properties.Item('50827').Value } Else {" "}
'Byte_PreviewApplicationName' = If ($image.Properties.Exists('50966')) { $image.Properties.Item('50966').Value } Else {" "}
'Byte_PreviewApplicationVersion'= If ($image.Properties.Exists('50967')) { $image.Properties.Item('50967').Value } Else {" "}
'Byte_PreviewSettingsDigest' = If ($image.Properties.Exists('50969')) { $image.Properties.Item('50969').Value } Else {" "}
'Byte_PreviewSettingsName' = If ($image.Properties.Exists('50968')) { $image.Properties.Item('50968').Value } Else {" "}
'Byte_ProfileCalibrationSignat' = If ($image.Properties.Exists('50932')) { $image.Properties.Item('50932').Value } Else {" "}
'Byte_ProfileCopyright' = If ($image.Properties.Exists('50942')) { $image.Properties.Item('50942').Value } Else {" "}
'Byte_ProfileName' = If ($image.Properties.Exists('50936')) { $image.Properties.Item('50936').Value } Else {" "}
'Byte_RawDataUniqueID' = If ($image.Properties.Exists('50781')) { $image.Properties.Item('50781').Value } Else {" "}
'Byte_TIFFEPStandardID' = If ($image.Properties.Exists('37398')) { $image.Properties.Item('37398').Value } Else {" "}
'Byte_XMLPacket' = If ($image.Properties.Exists('700')) { $image.Properties.Item('700').Value } Else {" "}
'CalibrationIlluminant1' = If ($image.Properties.Exists('50778')) { $image.Properties.Item('50778').Value } Else {" "}
'CalibrationIlluminant2' = If ($image.Properties.Exists('50779')) { $image.Properties.Item('50779').Value } Else {" "}
'CameraCalibration1' = If ($image.Properties.Exists('50723')) { $image.Properties.Item('50723').Value } Else {" "}
'CameraCalibration2' = If ($image.Properties.Exists('50724')) { $image.Properties.Item('50724').Value } Else {" "}
'CameraOwnerName' = If ($image.Properties.Exists('42032')) { $image.Properties.Item('42032').Value } Else {" "}
'CameraSerialNumber' = If ($image.Properties.Exists('50735')) { $image.Properties.Item('50735').Value } Else {" "}
'CellLength' = If ($image.Properties.Exists('265')) { $image.Properties.Item('265').Value } Else {" "}
'CellWidth' = If ($image.Properties.Exists('264')) { $image.Properties.Item('264').Value } Else {" "}
'CFALayout' = If ($image.Properties.Exists('50711')) { $image.Properties.Item('50711').Value } Else {" "}
'CFAPattern' = If ($image.Properties.Exists('41730')) { $image.Properties.Item('41730').Value } Else {" "}
'CFARepeatPatternDim' = If ($image.Properties.Exists('33421')) { $image.Properties.Item('33421').Value } Else {" "}
'ChromaBlurRadius' = If ($image.Properties.Exists('50737')) { $image.Properties.Item('50737').Value } Else {" "}
'ColorimetricReference' = If ($image.Properties.Exists('50879')) { $image.Properties.Item('50879').Value } Else {" "}
'ColorMap' = If ($image.Properties.Exists('320')) { $image.Properties.Item('320').Value } Else {" "}
'ColorMatrix1' = If ($image.Properties.Exists('50721')) { $image.Properties.Item('50721').Value } Else {" "}
'ColorMatrix2' = If ($image.Properties.Exists('50722')) { $image.Properties.Item('50722').Value } Else {" "}
'ComponentsConfiguration' = If ($image.Properties.Exists('37121')) { (($image.Properties.Item('37121').Value) -join ("")).Replace("0","-").Replace("1","Y").Replace("2","Cb").Replace("3","Cr").Replace("4","R").Replace("5","G").Replace("6","B").Replace(" ","") } Else {" "}
'CompressedBitsPerPixel' = If ($image.Properties.Exists('37122')) { ($image.Properties.Item('37122').Value) | select -ExpandProperty Value } Else {" "}
'Compression' = If ($image.Properties.Exists('259')) { $compress[[int]$image.Properties.Item('259').Value] } Else {" "}
'Copyright' = If ($image.Properties.Exists('33432')) { $image.Properties.Item('33432').Value } Else {" "}
'CurrentICCProfile' = If ($image.Properties.Exists('50833')) { $image.Properties.Item('50833').Value } Else {" "}
'CurrentPreProfileMatrix' = If ($image.Properties.Exists('50834')) { $image.Properties.Item('50834').Value } Else {" "}
'DefaultCropOrigin' = If ($image.Properties.Exists('50719')) { $image.Properties.Item('50719').Value } Else {" "}
'DefaultCropSize' = If ($image.Properties.Exists('50720')) { $image.Properties.Item('50720').Value } Else {" "}
'DefaultScale' = If ($image.Properties.Exists('50718')) { $image.Properties.Item('50718').Value } Else {" "}
'DeviceSettingDescription' = If ($image.Properties.Exists('41995')) { $image.Properties.Item('41995').Value } Else {" "}
'DocumentName' = If ($image.Properties.Exists('269')) { $image.Properties.Item('269').Value } Else {" "}
'ExifTag' = If ($image.Properties.Exists('34665')) { $image.Properties.Item('34665').Value } Else {" "}
'ExifVersion' = If ($image.Properties.Exists('36864')) { $ExifVer } Else {" "}
'ExposureIndex_2' = If ($image.Properties.Exists('41493')) { $image.Properties.Item('41493').Value } Else {" "}
'ExposureIndex' = If ($image.Properties.Exists('37397')) { $image.Properties.Item('37397').Value } Else {" "}
'ExposureProgram' = If ($image.Properties.Exists('34850')) { $exposurep[[int]$image.Properties.Item('34850').Value] } Else {" "}
'ExtraSamples' = If ($image.Properties.Exists('338')) { $extrasamp[[int]$image.Properties.Item('338').Value] } Else {" "}
'FillOrder' = If ($image.Properties.Exists('266')) { $fillord[[int]$image.Properties.Item('266').Value] } Else {" "}
'FlashEnergy_2' = If ($image.Properties.Exists('41483')) { $image.Properties.Item('41483').Value } Else {" "}
'FlashEnergy' = If ($image.Properties.Exists('37387')) { $image.Properties.Item('37387').Value } Else {" "}
'FlashpixVersion' = If ($image.Properties.Exists('40960')) { $FlashpixVer } Else {" "}
'FocalPlaneResolutionUnit' = If ($image.Properties.Exists('37392')) { $focalprun[[int]$image.Properties.Item('37392').Value] } Else {" "}
'FocalPlaneXResolution' = If ($image.Properties.Exists('37390')) { $image.Properties.Item('37390').Value } Else {" "}
'FocalPlaneYResolution' = If ($image.Properties.Exists('37391')) { $image.Properties.Item('37391').Value } Else {" "}
'ForwardMatrix1' = If ($image.Properties.Exists('50964')) { $image.Properties.Item('50964').Value } Else {" "}
'ForwardMatrix2' = If ($image.Properties.Exists('50965')) { $image.Properties.Item('50965').Value } Else {" "}
'FreeOffsets' = If ($image.Properties.Exists('288')) { $image.Properties.Item('288').Value } Else {" "}
'FreeByteCounts' = If ($image.Properties.Exists('289')) { $image.Properties.Item('289').Value } Else {" "}
'GPSAltitude' = If ($image.Properties.Exists('6')) { ($image.Properties.Item('6').Value) | select -ExpandProperty Value } Else {" "}
'GPSAreaInformation' = If ($image.Properties.Exists('28')) { $gpsarea } Else {" "}
'GPSDateStamp' = If ($image.Properties.Exists('29')) { $image.Properties.Item('29').Value } Else {" "}
'GPSDestBearing' = If ($image.Properties.Exists('24')) { $image.Properties.Item('24').Value } Else {" "}
'GPSDestBearingRef' = If ($image.Properties.Exists('23')) { $gpsdirect["$($image.Properties.Item('23').Value)"] } Else {" "}
'GPSDestDistance' = If ($image.Properties.Exists('26')) { $image.Properties.Item('26').Value } Else {" "}
'GPSDestDistanceRef' = If ($image.Properties.Exists('25')) { $gpsdistrf["$($image.Properties.Item('25').Value)"] } Else {" "}
'GPSDestLatitude' = If ($image.Properties.Exists('20')) { $image.Properties.Item('20').Value } Else {" "}
'GPSDestLatitudeRef' = If ($image.Properties.Exists('19')) { $image.Properties.Item('19').Value } Else {" "}
'GPSDestLongitude' = If ($image.Properties.Exists('22')) { $image.Properties.Item('22').Value } Else {" "}
'GPSDestLongitudeRef' = If ($image.Properties.Exists('21')) { $image.Properties.Item('21').Value } Else {" "}
'GPSDifferential' = If ($image.Properties.Exists('30')) { $gpsdiffer[[int]$image.Properties.Item('30').Value] } Else {" "}
# 'GPSDOP' = If ($image.Properties.Exists('11')) { $image.Properties.Item('11').Value } Else {" "}
'GPSHPositioningError' = If ($image.Properties.Exists('31')) { $image.Properties.Item('31').Value } Else {" "}
'GPSImgDirection' = If ($image.Properties.Exists('17')) { ($image.Properties.Item('17').Value) | select -ExpandProperty Value } Else {" "}
'GPSImgDirectionRef' = If ($image.Properties.Exists('16')) { $gpsdirect["$($image.Properties.Item('16').Value)"] } Else {" "}
'GPSLatitude' = If ($image.Properties.Exists('2')) { (($image.Properties.Item('2').Value) | select -ExpandProperty Value) -join (" ") } Else {" "}
'GPSLatitudeRef' = If ($image.Properties.Exists('1')) { $image.Properties.Item('1').Value } Else {" "}
'GPSLongitude' = If ($image.Properties.Exists('4')) { (($image.Properties.Item('4').Value) | select -ExpandProperty Value) -join (" ") } Else {" "}
'GPSLongitudeRef' = If ($image.Properties.Exists('3')) { $image.Properties.Item('3').Value } Else {" "}
'GPSMapDatum' = If ($image.Properties.Exists('18')) { $image.Properties.Item('18').Value } Else {" "}
'GPSMeasureMode' = If ($image.Properties.Exists('10')) { $gpsmeasure[[int]$image.Properties.Item('10').Value] } Else {" "}
'GPSProcessingMethod' = If ($image.Properties.Exists('27')) { $gpsproc } Else {" "}
'GPSSatellites' = If ($image.Properties.Exists('8')) { $image.Properties.Item('8').Value } Else {" "}
'GPSSpeed' = If ($image.Properties.Exists('13')) { $image.Properties.Item('13').Value } Else {" "}
'GPSSpeedRef' = If ($image.Properties.Exists('12')) { $gpsspeedrf["$($image.Properties.Item('12').Value)"] } Else {" "}
'GPSStatus' = If ($image.Properties.Exists('9')) { $gpsstat["$($image.Properties.Item('9').Value)"] } Else {" "}
'GPSTag' = If ($image.Properties.Exists('34853')) { $image.Properties.Item('34853').Value } Else {" "}
'GPSTimeStamp' = If ($image.Properties.Exists('7')) { (($image.Properties.Item('7').Value) | select -ExpandProperty Value) -join (':') } Else {" "}
'GPSTrack' = If ($image.Properties.Exists('15')) { $image.Properties.Item('15').Value } Else {" "}
'GPSTrackRef' = If ($image.Properties.Exists('14')) { $gpsdirect["$($image.Properties.Item('14').Value)"] } Else {" "}
'GrayResponseCurve' = If ($image.Properties.Exists('291')) { $image.Properties.Item('291').Value } Else {" "}
'GrayResponseUnit' = If ($image.Properties.Exists('290')) { $grayrespun[[int]$image.Properties.Item('290').Value] } Else {" "}
'HalftoneHints' = If ($image.Properties.Exists('321')) { $image.Properties.Item('321').Value } Else {" "}
'HostComputer' = If ($image.Properties.Exists('316')) { $image.Properties.Item('316').Value } Else {" "}
'ImageDescription' = If ($image.Properties.Exists('270')) { $image.Properties.Item('270').Value } Else {" "}
'ImageHistory' = If ($image.Properties.Exists('37395')) { $image.Properties.Item('37395').Value } Else {" "}
'ImageID' = If ($image.Properties.Exists('32781')) { $image.Properties.Item('32781').Value } Else {" "}
'ImageLength' = If ($image.Properties.Exists('257')) { $image.Properties.Item('257').Value } Else {" "}
'ImageNumber' = If ($image.Properties.Exists('37393')) { $image.Properties.Item('37393').Value } Else {" "}
'ImageUniqueID' = If ($image.Properties.Exists('42016')) { $image.Properties.Item('42016').Value } Else {" "}
'ImageWidth' = If ($image.Properties.Exists('256')) { $image.Properties.Item('256').Value } Else {" "}
'Indexed' = If ($image.Properties.Exists('346')) { $indexd[[int]$image.Properties.Item('346').Value] } Else {" "}
'InkNames' = If ($image.Properties.Exists('333')) { $image.Properties.Item('333').Value } Else {" "}
'InkSet' = If ($image.Properties.Exists('332')) { $incst[[int]$image.Properties.Item('332').Value] } Else {" "}
'Interlace' = If ($image.Properties.Exists('34857')) { $image.Properties.Item('34857').Value } Else {" "}
'InteroperabilityTag' = If ($image.Properties.Exists('40965')) { $image.Properties.Item('40965').Value } Else {" "}
'IPTCNAA' = If ($image.Properties.Exists('33723')) { $image.Properties.Item('33723').Value } Else {" "}
'ISOSpeed' = If ($image.Properties.Exists('34867')) { $image.Properties.Item('34867').Value } Else {" "}
'ISOSpeedLatitudeyyy' = If ($image.Properties.Exists('34868')) { $image.Properties.Item('34868').Value } Else {" "}
'ISOSpeedLatitudezzz' = If ($image.Properties.Exists('34869')) { $image.Properties.Item('34869').Value } Else {" "}
'JPEGACTables' = If ($image.Properties.Exists('521')) { $image.Properties.Item('521').Value } Else {" "}
'JPEGDCTables' = If ($image.Properties.Exists('520')) { $image.Properties.Item('520').Value } Else {" "}
'JPEGInterchangeFormat' = If ($image.Properties.Exists('513')) { $image.Properties.Item('513').Value } Else {" "}
'JPEGInterchangeFormatLength' = If ($image.Properties.Exists('514')) { $image.Properties.Item('514').Value } Else {" "}
'JPEGLosslessPredictors' = If ($image.Properties.Exists('517')) { $image.Properties.Item('517').Value } Else {" "}
'JPEGPointTransforms' = If ($image.Properties.Exists('518')) { $image.Properties.Item('518').Value } Else {" "}
'JPEGProc' = If ($image.Properties.Exists('512')) { $jpegpro[[int]$image.Properties.Item('512').Value] } Else {" "}
'JPEGQTables' = If ($image.Properties.Exists('519')) { $image.Properties.Item('519').Value } Else {" "}
'JPEGRestartInterval' = If ($image.Properties.Exists('515')) { $image.Properties.Item('515').Value } Else {" "}
'JPEGTables' = If ($image.Properties.Exists('347')) { $image.Properties.Item('347').Value } Else {" "}
'LensInfo' = If ($image.Properties.Exists('50736')) { $image.Properties.Item('50736').Value } Else {" "}
'LensMake' = If ($image.Properties.Exists('42035')) { $image.Properties.Item('42035').Value } Else {" "}
'LensModel' = If ($image.Properties.Exists('42036')) { $image.Properties.Item('42036').Value } Else {" "}
'LensSerialNumber' = If ($image.Properties.Exists('42037')) { $image.Properties.Item('42037').Value } Else {" "}
'LensSpecification' = If ($image.Properties.Exists('42034')) { $image.Properties.Item('42034').Value } Else {" "}
'LightSource' = If ($image.Properties.Exists('37384')) { $lightsrc[[int]$image.Properties.Item('37384').Value] } Else {" "}
'LinearizationTable' = If ($image.Properties.Exists('50712')) { $image.Properties.Item('50712').Value } Else {" "}
'LinearResponseLimit' = If ($image.Properties.Exists('50734')) { $image.Properties.Item('50734').Value } Else {" "}
# 'MakerNote' = If ($image.Properties.Exists('37500')) { $MakerNote } Else {" "}
'MakerNoteSafety' = If ($image.Properties.Exists('50741')) { $image.Properties.Item('50741').Value } Else {" "}
'MaskedAreas' = If ($image.Properties.Exists('50830')) { $image.Properties.Item('50830').Value } Else {" "}
'NewSubfileType' = If ($image.Properties.Exists('254')) { $image.Properties.Item('254').Value } Else {" "}
'Noise' = If ($image.Properties.Exists('37389')) { $image.Properties.Item('37389').Value } Else {" "}
'NoiseProfile' = If ($image.Properties.Exists('51041')) { $image.Properties.Item('51041').Value } Else {" "}
'NoiseReductionApplied' = If ($image.Properties.Exists('50935')) { $image.Properties.Item('50935').Value } Else {" "}
'NumberOfInks' = If ($image.Properties.Exists('334')) { $image.Properties.Item('334').Value } Else {" "}
'OECF' = If ($image.Properties.Exists('34856')) { $image.Properties.Item('34856').Value } Else {" "}
'OpcodeList1' = If ($image.Properties.Exists('51008')) { $image.Properties.Item('51008').Value } Else {" "}
'OpcodeList2' = If ($image.Properties.Exists('51009')) { $image.Properties.Item('51009').Value } Else {" "}
'OpcodeList3' = If ($image.Properties.Exists('51022')) { $image.Properties.Item('51022').Value } Else {" "}
'OPIProxy' = If ($image.Properties.Exists('351')) { $opiprox[[int]$image.Properties.Item('351').Value] } Else {" "}
'OriginalRawFileData' = If ($image.Properties.Exists('50828')) { $image.Properties.Item('50828').Value } Else {" "}
'OriginalRawFileDigest' = If ($image.Properties.Exists('50973')) { $image.Properties.Item('50973').Value } Else {" "}
'PageNumber' = If ($image.Properties.Exists('297')) { $image.Properties.Item('297').Value } Else {" "}
'PhotometricInterpretation' = If ($image.Properties.Exists('262')) { $photmtrint[[int]$image.Properties.Item('262').Value] } Else {" "}
'PlanarConfiguration' = If ($image.Properties.Exists('284')) { $planarconf[[int]$image.Properties.Item('284').Value] } Else {" "}
'Predictor' = If ($image.Properties.Exists('317')) { $predict[[int]$image.Properties.Item('317').Value] } Else {" "}
'PreviewColorSpace' = If ($image.Properties.Exists('50970')) { $previewcol[[int]$image.Properties.Item('50970').Value] } Else {" "}
'PreviewDateTime' = If ($image.Properties.Exists('50971')) { $image.Properties.Item('50971').Value } Else {" "}
'PrimaryChromaticities' = If ($image.Properties.Exists('319')) { (($image.Properties.Item('319').Value) | select -ExpandProperty Value) -join (" ") } Else {" "}
'PrintImageMatching' = If ($image.Properties.Exists('50341')) { $image.Properties.Item('50341').Value } Else {" "}
'ProcessingSoftware' = If ($image.Properties.Exists('11')) { ($image.Properties.Item('11').Value) | select -ExpandProperty Value } Else {" "}
'ProfileEmbedPolicy' = If ($image.Properties.Exists('50941')) { $image.Properties.Item('50941').Value } Else {" "}
'ProfileHueSatMapData1' = If ($image.Properties.Exists('50938')) { $image.Properties.Item('50938').Value } Else {" "}
'ProfileHueSatMapData2' = If ($image.Properties.Exists('50939')) { $image.Properties.Item('50939').Value } Else {" "}
'ProfileHueSatMapDims' = If ($image.Properties.Exists('50937')) { $image.Properties.Item('50937').Value } Else {" "}
'ProfileLookTableData' = If ($image.Properties.Exists('50982')) { $image.Properties.Item('50982').Value } Else {" "}
'ProfileLookTableDims' = If ($image.Properties.Exists('50981')) { $image.Properties.Item('50981').Value } Else {" "}
'ProfileToneCurve' = If ($image.Properties.Exists('50940')) { $image.Properties.Item('50940').Value } Else {" "}
'Rating' = If ($image.Properties.Exists('18246')) { $image.Properties.Item('18246').Value } Else {" "}
'RatingPercent' = If ($image.Properties.Exists('18249')) { $image.Properties.Item('18249').Value } Else {" "}
'RawImageDigest' = If ($image.Properties.Exists('50972')) { $image.Properties.Item('50972').Value } Else {" "}
'RecommendedExposureIndex' = If ($image.Properties.Exists('34866')) { $image.Properties.Item('34866').Value } Else {" "}
'ReductionMatrix1' = If ($image.Properties.Exists('50725')) { $image.Properties.Item('50725').Value } Else {" "}
'ReductionMatrix2' = If ($image.Properties.Exists('50726')) { $image.Properties.Item('50726').Value } Else {" "}
'ReferenceBlackWhite' = If ($image.Properties.Exists('532')) { $image.Properties.Item('532').Value } Else {" "}
'RelatedSoundFile' = If ($image.Properties.Exists('40964')) { $image.Properties.Item('40964').Value } Else {" "}
'RowInterleaveFactor' = If ($image.Properties.Exists('50975')) { $image.Properties.Item('50975').Value } Else {" "}
'RowsPerStrip' = If ($image.Properties.Exists('278')) { $image.Properties.Item('278').Value } Else {" "}
'SampleFormat' = If ($image.Properties.Exists('339')) { $image.Properties.Item('339').Value } Else {" "}
'SamplesPerPixel' = If ($image.Properties.Exists('277')) { $image.Properties.Item('277').Value } Else {" "}
'SceneType' = If ($image.Properties.Exists('41729')) { $image.Properties.Item('41729').Value } Else {" "}
'SecurityClassification' = If ($image.Properties.Exists('37394')) { $securitycl["$($image.Properties.Item('37394').Value)"] } Else {" "}
'SelfTimerMode' = If ($image.Properties.Exists('34859')) { $image.Properties.Item('34859').Value } Else {" "}
'Sensing Method_2' = If ($image.Properties.Exists('37399')) { $sensmethod[[int]$image.Properties.Item('37399').Value] } Else {" "}
'SensitivityType' = If ($image.Properties.Exists('34864')) { $sensittyp[[int]$image.Properties.Item('34864').Value] } Else {" "}
'ShadowScale' = If ($image.Properties.Exists('50739')) { $image.Properties.Item('50739').Value } Else {" "}
'SMaxSampleValue' = If ($image.Properties.Exists('341')) { $image.Properties.Item('341').Value } Else {" "}
'SMinSampleValue' = If ($image.Properties.Exists('340')) { $image.Properties.Item('340').Value } Else {" "}
'Software' = If ($image.Properties.Exists('305')) { $image.Properties.Item('305').Value } Else {" "}
'SpatialFrequencyResponse_2' = If ($image.Properties.Exists('41484')) { $image.Properties.Item('41484').Value } Else {" "}
'SpatialFrequencyResponse' = If ($image.Properties.Exists('37388')) { $image.Properties.Item('37388').Value } Else {" "}
'SpectralSensitivity' = If ($image.Properties.Exists('34852')) { $image.Properties.Item('34852').Value } Else {" "}
'StandardOutputSensitivity' = If ($image.Properties.Exists('34865')) { $image.Properties.Item('34865').Value } Else {" "}
'StripByteCounts' = If ($image.Properties.Exists('279')) { $image.Properties.Item('279').Value } Else {" "}
'StripOffsets' = If ($image.Properties.Exists('273')) { $image.Properties.Item('273').Value } Else {" "}
'SubfileType' = If ($image.Properties.Exists('255')) { $subfiletyp[[int]$image.Properties.Item('255').Value] } Else {" "}
'SubIFDs' = If ($image.Properties.Exists('330')) { $image.Properties.Item('330').Value } Else {" "}
'SubjectArea' = If ($image.Properties.Exists('37396')) { $image.Properties.Item('37396').Value } Else {" "}
'SubjectDistance' = If ($image.Properties.Exists('37382')) { $image.Properties.Item('37382').Value } Else {" "}
'SubjectLocation' = If ($image.Properties.Exists('41492')) { $image.Properties.Item('41492').Value } Else {" "}
'SubSecTime' = If ($image.Properties.Exists('37520')) { $image.Properties.Item('37520').Value } Else {" "}
'SubSecTimeDigitized' = If ($image.Properties.Exists('37522')) { $image.Properties.Item('37522').Value } Else {" "}
'SubSecTimeOriginal' = If ($image.Properties.Exists('37521')) { $image.Properties.Item('37521').Value } Else {" "}
'SubTileBlockSize' = If ($image.Properties.Exists('50974')) { $image.Properties.Item('50974').Value } Else {" "}
'T4Options' = If ($image.Properties.Exists('292')) { $image.Properties.Item('292').Value } Else {" "}
'T6Options' = If ($image.Properties.Exists('293')) { $image.Properties.Item('293').Value } Else {" "}
'TargetPrinter' = If ($image.Properties.Exists('337')) { $image.Properties.Item('337').Value } Else {" "}
'Thresholding' = If ($image.Properties.Exists('263')) { $threshold[[int]$image.Properties.Item('263').Value] } Else {" "}
'TileByteCounts' = If ($image.Properties.Exists('325')) { $image.Properties.Item('325').Value } Else {" "}
'TileLength' = If ($image.Properties.Exists('323')) { $image.Properties.Item('323').Value } Else {" "}
'TileOffsets' = If ($image.Properties.Exists('324')) { $image.Properties.Item('324').Value } Else {" "}
'TileWidth' = If ($image.Properties.Exists('322')) { $image.Properties.Item('322').Value } Else {" "}
'TimeZoneOffset' = If ($image.Properties.Exists('34858')) { $image.Properties.Item('34858').Value } Else {" "}
'TransferFunction' = If ($image.Properties.Exists('301')) { $image.Properties.Item('301').Value } Else {" "}
'TransferRange' = If ($image.Properties.Exists('342')) { $image.Properties.Item('342').Value } Else {" "}
'UniqueCameraModel' = If ($image.Properties.Exists('50708')) { $image.Properties.Item('50708').Value } Else {" "}
'UserComment' = If ($image.Properties.Exists('37510')) { $usercomment } Else {" "}
'WhiteLevel' = If ($image.Properties.Exists('50717')) { $image.Properties.Item('50717').Value } Else {" "}
'WhitePoint' = If ($image.Properties.Exists('318')) { (($image.Properties.Item('318').Value) | select -ExpandProperty Value) -join (" ") } Else {" "}
'XClipPathUnits' = If ($image.Properties.Exists('344')) { $image.Properties.Item('344').Value } Else {" "}
'YCbCrCoefficients' = If ($image.Properties.Exists('529')) { $image.Properties.Item('529').Value } Else {" "}
'YCbCrPositioning' = If ($image.Properties.Exists('531')) { $ycbcrpos[[int]$image.Properties.Item('531').Value] } Else {" "}
'YCbCrSubSampling' = If ($image.Properties.Exists('530')) { $image.Properties.Item('530').Value } Else {" "}
'YClipPathUnits' = If ($image.Properties.Exists('345')) { $image.Properties.Item('345').Value } Else {" "}
# Source: http://nicholasarmstrong.com/2010/02/exif-quick-reference/
# Source: https://sno.phy.queensu.ca/~phil/exiftool/TagNames/EXIF.html
# Credit: Franck Richard: "Use PowerShell to Remove Metadata and Resize Images": http://franckrichard.blogspot.com/2011/04/2011-scripting-games-advanced-event-8.html
'Acceleration' = If ($image.Properties.Exists('37892')) { $image.Properties.Item('37892').Value } Else {" "}
'Aperture' = If ($image.Properties.Exists('37378')) { ($image.Properties.Item('37378').Value).Value } Else {" "}
'ApplicationNotes' = If ($image.Properties.Exists('700')) { $image.Properties.Item('700').Value } Else {" "}
'BadFaxLines' = If ($image.Properties.Exists('326')) { $image.Properties.Item('326').Value } Else {" "}
'CameraElevationAngle' = If ($image.Properties.Exists('37893')) { $image.Properties.Item('37893').Value } Else {" "}
'CameraLabel' = If ($image.Properties.Exists('51105')) { $image.Properties.Item('51105').Value } Else {" "}
'CleanFaxData' = If ($image.Properties.Exists('327')) { $clnfaxdata[[int]$image.Properties.Item('327').Value] } Else {" "}
'CodingMethods' = If ($image.Properties.Exists('403')) { $image.Properties.Item('403').Value } Else {" "}
'Color Space' = If ($image.Properties.Exists('40961')) { (($image.Properties.Item('40961').Value) -join ("")).Replace("1","sRGB").Replace("FFFF.H","Uncalibrated") } Else {" "}
'ColorResponseUnit' = If ($image.Properties.Exists('300')) { $image.Properties.Item('300').Value } Else {" "}
'ConsecutiveBadFaxLines' = If ($image.Properties.Exists('328')) { $image.Properties.Item('328').Value } Else {" "}
'Contrast' = If ($image.Properties.Exists('41992')) { $contrast[[int]$image.Properties.Item('41992').Value] } Else {" "}
'Custom Rendered' = If ($image.Properties.Exists('41985')) { $custrender[[int]$image.Properties.Item('41985').Value] } Else {" "}
'Date Digitized' = If ($image.Properties.Exists('36868')) { $image.Properties.Item('36868').Value } Else {" "}
'Date Taken' = If ($image.Properties.Exists('36867')) { $image.Properties.Item('36867').Value } Else {" "}
'Decode' = If ($image.Properties.Exists('433')) { $image.Properties.Item('433').Value } Else {" "}
'DefaultImageColor' = If ($image.Properties.Exists('434')) { $image.Properties.Item('434').Value } Else {" "}
'Digital Zoom Ratio' = If ($image.Properties.Exists('41988')) { ($image.Properties.Item('41988').Value).Value } Else {" "}
'FocalLength' = If ($image.Properties.Exists('37386')) { ($image.Properties.Item('37386').Value).Value } Else {" "}
'Equipment Maker' = If ($image.Properties.Exists('271')) { $image.Properties.Item('271').Value } Else {" "}
'Equipment Model' = If ($image.Properties.Exists('272')) { $image.Properties.Item('272').Value } Else {" "}
'ExpandLens' = If ($image.Properties.Exists('44993')) { $image.Properties.Item('44993').Value } Else {" "}
'ExpandSoftware' = If ($image.Properties.Exists('44992')) { $image.Properties.Item('44992').Value } Else {" "}
'Exposure Compensation' = If ($image.Properties.Exists('37380')) { ($image.Properties.Item('37380').Value).Value } Else {" "}
'Exposure Mode' = If ($image.Properties.Exists('41986')) { $exposurem[[int]$image.Properties.Item('41986').Value] } Else {" "}
'Exposure Time' = If ($image.Properties.Exists('33434')) { ($image.Properties.Item('33434').Value).Value } Else {" "}
'F Number' = If ($image.Properties.Exists('33437')) { ($image.Properties.Item('33437').Value).Value } Else {" "}
'FaxProfile' = If ($image.Properties.Exists('402')) { $faxprofil[[int]$image.Properties.Item('402').Value] } Else {" "}
'File Source' = If ($image.Properties.Exists('41728')) { $filesrc[[int]$image.Properties.Item('41728').Value] } Else {" "}
# 'Flash' = If ($image.Properties.Exists('37385')) { $image.Properties.Item('37385').Value } Else {" "}
'Flash' = If ($image.Properties.Exists('37385')) { $flashvalue[[int]$image.Properties.Item('37385').Value] } Else {" "}
'Focal Length in 35 mm Format' = If ($image.Properties.Exists('41989')) { $image.Properties.Item('41989').Value } Else {" "}
'Focal Plane Resolution Unit' = If ($image.Properties.Exists('41488')) { $focal[[int]$image.Properties.Item('41488').Value] } Else {" "}
'Focal Plane X Resolution' = If ($image.Properties.Exists('41486')) { $image.Properties.Item('41486').Value } Else {" "}
'Focal Plane Y Resolution' = If ($image.Properties.Exists('41487')) { $image.Properties.Item('41487').Value } Else {" "}
'Gain Control' = If ($image.Properties.Exists('41991')) { $gain[[int]$image.Properties.Item('41991').Value] } Else {" "}
'Gamma' = If ($image.Properties.Exists('42240')) { $image.Properties.Item('42240').Value } Else {" "}
'Humidity' = If ($image.Properties.Exists('37889')) { $image.Properties.Item('37889').Value } Else {" "}
'ImageHistory_2' = If ($image.Properties.Exists('41491')) { $image.Properties.Item('41491').Value } Else {" "}