This commit is contained in:
2019-05-07 01:52:15 -07:00
parent c81e15bee0
commit 0fae2a9042

504
leaf.php
View File

@@ -2,12 +2,48 @@
<?php
// Leaf - Tools for Book Scans
$version = "0.6.6";
$version = "0.6.8";
$time_start = microtime(true);
date_default_timezone_set("America/Los_Angeles");
// Functions
function multiexec($thread, $x) {
$batch = array_chunk($thread,$x);
foreach ($batch as $group) {
$msg = array();
$cmd = array();
foreach ($group as $parts) {
$msg[] = $parts[0];
$cmd[] = $parts[1];
}
$echo = implode("\n", $msg);
$exec = implode(" > /dev/null & ",$cmd)." & wait";
echo $echo."\n";
exec($exec);
}
}
function getdng($jpg) {
$ext = pathinfo($jpg,PATHINFO_EXTENSION);
$check = glob("*/".basename($jpg,$ext)."DNG");
if (isset($check[0])) {
return $check[0];
} else {
return null;
}
}
function getjpg($dng) {
$ext = pathinfo($dng,PATHINFO_EXTENSION);
$check = glob("*/".basename($dng,$ext)."JPG");
if (isset($check[0])) {
return $check[0];
} else {
return null;
}
}
function fin($print = null) {
if (isset($print)) {
echo "\n".$print;
@@ -96,7 +132,7 @@ if (!is_dir("scratch")) {
}
////////////////////////////////////////////////////////////////////////////////////////////////
// Help
// Note: Help
//////////////////////
if (!args("app") | args("app") == "help" | args("app") == "-help" | args("app") == "--help") {
/////////////////////////////////////////////////////////////////////////
@@ -105,6 +141,8 @@ $help = "Leaf $version
USAGE: leaf [mode] [-options] directory
Modes:
crop define EXIF crop values using template files
-crops=<num> specify how many files to use
desort remove image sequence prefix
divide wrapper for imagemagick Divide_Src
-map=<file> specify brightness file
@@ -132,7 +170,7 @@ echo $help;
fin();
////////////////////////////////////////////////////////////////////////////////////////////////
// Profile
// Note: Profile
//////////////////////
} elseif (args("app") == "profile") {
echo Welcome("Apply XMP profile to images");
@@ -150,10 +188,12 @@ echo $profile.": ".date("F d, Y", filemtime($profile))." (".count(file($profile)
$lines = file_get_contents($profile);
$check[] = "crs:RawFileName";
$check[] = "crs:WhiteBalance";
$check[] = "crs:Sharpness";
$check[] = "crs:LensProfileName";
$check[] = "crs:Temperature";
$check[] = "crs:Tint";
$check[] = "crs:IncrementalTemperature";
$check[] = "crs:IncrementalTint";
$check[] = "crs:Sharpness";
$check[] = "crs:LensProfileName";
foreach ($check as $query) {
preg_match("/^.*".$query.".*\$/m",$lines,$matches);
if ($matches) {
@@ -172,7 +212,7 @@ foreach ($files as $file) {
fin();
////////////////////////////////////////////////////////////////////////////////////////////////
// Sort
// Note: Sort
//////////////////////
} elseif (args("app") == "sort") {
echo Welcome("Sort files AAABBB -> ABABAB");
@@ -192,10 +232,82 @@ if (args("m")) {
$midpoint_key = filter_var($mid, FILTER_SANITIZE_NUMBER_INT);
}
$e = 2; $o = 1;
foreach ($files as $file) {
$num = filter_var($file, FILTER_SANITIZE_NUMBER_INT);
if ($num < $midpoint_key) {
$new = args("dir").sprintf('%03d',$e)."-".basename($file);
$ops[$e] = array($file,$new,8);
$e = $e+2;
} else {
$new = args("dir").sprintf('%03d',$o)."-".basename($file);
$ops[$o] = array($file,$new,6);
$o = $o+2;
}
}
ksort($ops);
foreach ($ops as $op) {
msg(bashcolor($op[0],"green")." will be renamed ".bashcolor($op[1],"cyan").", orientation=".bashcolor($op[2],"purple"));
}
$range = range(2,count($ops)/2+2);
$length = count($range);
$quarter = count($range)/4;
$most = array_slice($range, 1, $length-$quarter, 1);
$rest = array_slice($range, $length-$quarter, $quarter, 1);
$picks = array_merge(array_rand($most, 2), array_rand($rest, 8));
echo "\n";
if (ask("Create spreads? (Y/n)") != "n") {
echo "Creating spreads: ";
foreach($picks as $key) {
$left = $ops[($key*2)]; $right = $ops[($key*2)+1];
$ext = pathinfo($left[0],PATHINFO_EXTENSION);
$lfile = $left[0]; $rfile = $right[0];
$tmpleft = "/tmp/".basename($left[1]); $tmpright = "/tmp/".basename($right[1]);
if ($ext == "DNG" && getjpg($left[0]) && getjpg($right[0])) {
$lfile = getjpg($left[0]); $rfile = getjpg($right[0]);
$tmpleft = "/tmp/".basename($left[1],$ext)."JPG"; $tmpright = "/tmp/".basename($right[1],$ext)."JPG";
} elseif ($ext == "DNG") {
echo "-";
continue;
}
copy($lfile,$tmpleft); copy($rfile,$tmpright);
exec("exiftool -overwrite_original -n -Orientation=".$left[2]." ".$tmpleft."; exiftool -overwrite_original -n -Orientation=".$right[2]." ".$tmpright."; ");
exec("montage -label '%f' -font Helvetica -pointsize 20 -background '#000000' -fill 'white' -define jpeg:size=1000x1000 -geometry 1000x1000+2+2 -auto-orient ".$tmpleft." ".$tmpright." /tmp/contact_sheet_".$key.".jpg");
$sheets[] = "/tmp/contact_sheet_".$key.".jpg";
echo ".";
}
echo "\n\n";
if (isset($sheets)) {
exec("xattr -c ".implode(" ", $sheets));
$term = chop(shell_exec("env | grep 'TERM_PROGRAM=' | cut -f2- -d="));
if ($term == "iTerm.app") {
echo shell_exec("imgcat ".implode(" ", $sheets));
} else {
exec("open ".implode(" ", $sheets)." -b com.apple.Preview");
}
} else {
msg("Spread creation failed");
}
msg("Continue?",2);
}
echo "Moving files: ";
foreach ($ops as $key => $op) {
rename($op[0],$op[1]);
exec("exiftool -overwrite_original -n -Orientation=".$op[2]." ".$op[1]);
echo ".";
}
fin();
////////////////////////////////////////////////////////////////////////////////////////////////
// Desort
// Note: Desort
//////////////////////
} elseif (args("app") == "desort") {
echo Welcome("Remove image sequence");
@@ -221,9 +333,94 @@ foreach ($ops as $parts) {
fin();
////////////////////////////////////////////////////////////////////////////////////////////////
// Dupes
// Note: Crop
//////////////////////
} elseif (args("app") == "crop") {
echo Welcome("Define crop areas and apply to EXIF tags");
/////////////////////////////////////////////////////////////////////////
if (args("crops")) {
$multicrops = args("crops");
} else {
$multicrops = 6;
}
$files = glob(args("dir")."*.*");
if ($multicrops > 1) {
foreach ($files as $file) {
$key = filter_var(substr(basename($file), 4), FILTER_SANITIZE_NUMBER_INT);
$seq[$key] = $file;
}
ksort($seq);
$seg = floor(count($seq)/$multicrops)-1;
$picks = array();
foreach (range(1, $multicrops, 1) as $val) {
$picks[] = array_values(array_slice($seq, $val*$seg, 1))[0];
}
} else {
$picks[] = $files[floor(count($files)*.7)];
}
msg("Files tagged for crop:\n");
foreach ($picks as $file) {
echo $file."\n";
exec("exiftool -overwrite_original -Label='crop' ".$file);
}
echo "\n";
ask("Press return to open Bridge.");
exec("open ".args("dir")." -b com.adobe.bridge7");
ask("Press return when crops have been applied.");
foreach ($picks as $file) {
$parts = chop(shell_exec("exiftool -s -s -s -XMP-crs:CropTop -XMP-crs:CropRight -XMP-crs:CropLeft -XMP-crs:CropBottom ".$file." 2>&1"));
@list($top, $right, $left, $bottom) = explode("\n", $parts);
if ($top && $right && $left && $bottom) {
$key = filter_var(substr(basename($file), 4), FILTER_SANITIZE_NUMBER_INT);
$crops[$key]['top'] = $top;
$crops[$key]['right'] = $right;
$crops[$key]['left'] = $left;
$crops[$key]['bottom'] = $bottom;
} else {
msg("Problem reading crops from file ".$file.". Continue?",2);
}
}
echo "Crop areas have been detected as follows. Press return to write to files.\n";
foreach ($crops as $key => $parts) {
echo "\n";
echo $key."\t\tTop: ".bashcolor($parts['top'], $colors[array_search($key,array_keys($crops))]);
echo "\tRight: ".bashcolor($parts['right'], $colors[array_search($key,array_keys($crops))]);
echo "\tLeft: ".bashcolor($parts['left'], $colors[array_search($key,array_keys($crops))]);
echo "\tBottom: ".bashcolor($parts['bottom'], $colors[array_search($key,array_keys($crops))]);
}
ask("");
echo "Crop Mapping:\n";
foreach ($files as $file) {
$key = filter_var(substr(basename($file), 4), FILTER_SANITIZE_NUMBER_INT);
$closekey = getClosest($key, array_keys($crops));
$parts = $crops[$closekey];
echo "\n";
echo $file."\t\tTop: ".bashcolor($parts['top'], $colors[array_search($closekey,array_keys($crops))]);
echo "\tRight: ".bashcolor($parts['right'], $colors[array_search($closekey,array_keys($crops))]);
echo "\tLeft: ".bashcolor($parts['left'], $colors[array_search($closekey,array_keys($crops))]);
echo "\tBottom: ".bashcolor($parts['bottom'], $colors[array_search($closekey,array_keys($crops))]);
exec("exiftool -overwrite_original -XMP-crs:HasCrop=1 -XMP-crs:AlreadyApplied=0 -XMP-crs:CropTop=".$parts['top']." -XMP-crs:CropRight=".$parts['right']." -XMP-crs:CropLeft=".$parts['left']." -XMP-crs:CropBottom=".$parts['bottom']." ".$file);
}
echo "\n";
fin();
////////////////////////////////////////////////////////////////////////////////////////////////
// Note: Dupes
//////////////////////
function dupes() {}
} elseif (args("app") == "dupes") {
echo Welcome("Find duplicate images");
/////////////////////////////////////////////////////////////////////////
@@ -247,6 +444,10 @@ $files = glob(args("dir")."*.*");
echo "Checking thumbnails: ";
foreach ($files as $file) {
$ext = pathinfo($file,PATHINFO_EXTENSION);
if (strtolower($ext) == "dng") {
$file = getjpg($file);
}
$tnfile = "scratch/".basename($file,".".pathinfo($file,PATHINFO_EXTENSION))."_thumb.".pathinfo($file, PATHINFO_EXTENSION);
if (!file_exists($tnfile)) {
echo ".";
@@ -268,7 +469,7 @@ foreach ($tnfiles as $file) {
$done[$file][$nfile] = 1;
if ($file != $nfile && $diff < $walk && isset($done[$nfile][$file])) {
echo ".";
$distance = shell_exec("compare -metric phash ".$file." ".$nfile." diffimage 2>&1")."\n";
$distance = shell_exec("compare -metric phash ".$file." ".$nfile." /tmp/diffimage 2>&1");
if ($distance < $threshold) {
$match[] = array($file, $nfile, $distance);
}
@@ -279,7 +480,7 @@ foreach ($tnfiles as $file) {
echo "\n\n";
foreach ($match as $pair) {
echo $pair[0]." <> ".$pair[1]." = ".$pair[2];
echo $pair[0]." <> ".$pair[1]." = ".$pair[2]."\n";
}
echo "\n";
@@ -289,16 +490,18 @@ msg("Review duplicates?",2);
foreach ($match as $pair) {
$afile = args("dir").basename(str_replace("_thumb", "", $pair[1]));
$bfile = args("dir").basename(str_replace("_thumb", "", $pair[0]));
if (strtolower($ext) == "dng") {
$afile = getdng($afile);
$bfile = getdng($bfile);
}
ask("Press return to compare ".$afile." to ".$bfile);
//@exec("montage -label '%f' -font Helvetica -pointsize 20 -background '#000000' -fill 'white' -define jpeg:size=600x600 -geometry 600x600+2+2 -auto-orient ".$afile." ".$bfile." /tmp/contact_sheet.jpg");
//@exec("open /tmp/contact_sheet.jpg -b com.apple.Preview");
@exec("open ".$afile." ".$bfile." -b com.apple.Preview");
}
fin();
////////////////////////////////////////////////////////////////////////////////////////////////
// Resort
// Note: Resort
//////////////////////
} elseif (args("app") == "resort") {
echo Welcome("Insert image into numbered sequence");
@@ -351,7 +554,7 @@ foreach ($ops as $parts) {
fin("Starting file count: ".$count."; Ending file count: ".count(glob(args("dir")."[0-9][0-9][0-9]-*.jpg")));
////////////////////////////////////////////////////////////////////////////////////////////////
// Review
// Note: Review
//////////////////////
} elseif (args("app") == "review") {
echo Welcome("List image dimension statistics");
@@ -434,7 +637,7 @@ foreach ($files as $file) {
fin();
////////////////////////////////////////////////////////////////////////////////////////////////
// Makepdf
// Note: Makepdf
//////////////////////
} elseif (args("app") == "makepdf") {
echo Welcome("Combine finished images into a pdf with python img2pdf");
@@ -455,14 +658,15 @@ exec("open ".$dest." -b com.adobe.Acrobat.Pro");
fin();
////////////////////////////////////////////////////////////////////////////////////////////////
// Divide
// Note: we assume a .JPG file is an unmodified DCIM image and convert to a greyscale tif for overlay.
// Note: Divide
// We assume a .JPG file is an unmodified DCIM image and convert to a greyscale tif for overlay.
// A .jpg file is treated like a prepared brightness map file and is unmodified.
//////////////////////
} elseif (args("app") == "divide") {
echo Welcome("Composite image from brightness map");
/////////////////////////////////////////////////////////////////////////
$xt = 8;
$files = glob(args("dir")."*.{jpg,JPG,tif}", GLOB_BRACE);
if (!args("map")) {
@@ -494,32 +698,32 @@ if (args("q")) {
$quality = 95;
}
$thread = array();
foreach ($files as $file) {
echo "Dividing ".$file." with ".$map.", Q=".$quality;
$msg = "Dividing ".$file." with ".$map.", Q=".$quality;
list ($width, $height) = getimagesize($map);
list ($twidth, $theight) = getimagesize($file);
if ($width != $twidth | $height != $theight) {
$tmap = $map."'[".$twidth."x".$theight."!]'";
echo " (resize map) ";
$msg .= " (resize map) ";
} else {
$tmap = $map;
}
if (args("adjust")) {
echo " (".args("adjust").")";
$msg .= " (".args("adjust").")";
$cmd = "convert ".$file." ".$tmap." -compose Divide_Src -composite -level ".args("adjust")." -quality ".$quality." ".$dest."/".basename($file);
@exec($cmd);
} else {
$cmd = "convert ".$file." ".$tmap." -compose Divide_Src -composite -quality ".$quality." ".$dest."/".basename($file);
@exec($cmd);
}
echo "\n";
$thread[] = array($msg, $cmd);
}
msg("Beginning multithreaded convert with ".$xt." threads");
multiexec($thread,$xt);
fin();
////////////////////////////////////////////////////////////////////////////////////////////////
// SetDPI
// Note: SetDPI
//////////////////////
} elseif (args("app") == "setdpi") {
echo Welcome("Batch set EXIF resolution tags");
@@ -561,7 +765,7 @@ foreach ($files as $file) {
fin();
////////////////////////////////////////////////////////////////////////////////////////////////
// Strip
// Note: Strip
//////////////////////
} elseif (args("app") == "strip") {
echo Welcome("Strip crop values from images");
@@ -590,7 +794,7 @@ foreach ($files as $file) {
fin();
////////////////////////////////////////////////////////////////////////////////////////////////
// Deskew
// Note: Deskew
//////////////////////
} elseif (args("app") == "deskew") {
echo Welcome("Detect skew angle and apply to EXIF tags");
@@ -686,32 +890,6 @@ $deskew_contrast = 20;
$deskew_size = 2200;
$multicrops = 8;
// Header
echo "\033[1;1H\033[2J"; // clear screen
echo "Welcome to avision_jpg version ".$version."\n";
echo "Processing ".basename($_SERVER["PWD"])."\n";
echo "---------------------------------------------------------------------------\n\n";
// Dirs
if (!file_exists($input_dir)) {
if (!file_exists($tif_dir)) {
echo "No input dirs, exiting\n";
die;
} else {
mkdir ($input_dir);
}
}
if (!file_exists($xmp_profile)) {
echo "No xmp profile, exiting\n";
die;
}
if (!file_exists("scratch")) {
mkdir("scratch");
}
if (file_exists($tif_dir)) {
echo "Checking jpegs: ";
@@ -729,221 +907,7 @@ if (file_exists($tif_dir)) {
$files = glob($input_dir."/*.jpg");
// Renumber files
if (glob($input_dir."/001-*.jpg")) {
echo "It appears files have been numbered, skipping.\n";
} else {
echo "Checking thumbnails: ";
foreach ($files as $file) {
$tnfile = "scratch/".basename($file, ".jpg")."_thumb.jpg";
if (!file_exists($tnfile)) {
echo ".";
exec("vipsthumbnail ".$file." --size 160x160 -o ../".$tnfile." 2>&1");
} else {
echo "o";
}
}
echo "\n\nPlease specify the midpoint (cover image) or enter \"none\"\n";
$midpoint_key = trim(fgets(fopen("php://stdin","r")));
echo "\n";
if ($midpoint_key != "none") {
if (!glob($input_dir."/*".$midpoint_key."*.jpg")) {
echo "Can't find midpoint matching '".$midpoint_key."', exiting\n";
die;
}
}
$i = 0;
foreach ($files as $file) {
$tnfile = "scratch/".basename($file, ".jpg")."_thumb.jpg";
if ($i > 1) {
$prev = $files[array_search($file,$files)-1];
$prevtnfile = "scratch/".basename($prev, ".jpg")."_thumb.jpg";
$thingy = shell_exec("compare -metric ae -fuzz '10%' ".$tnfile." ".$prevtnfile." /tmp/null 2>&1");
echo $tnfile." <> ".$prevtnfile." = ".$thingy."\n";
if ($thingy < $compare_threshold) {
echo "Possible duplicates: ".basename($file)." <> ".basename($prev).". Press return to compare.";
fgets(fopen("php://stdin","r"));
exec("open ".$prev." ".$file." -b com.apple.Preview");
echo "0 (default) = Keep ".basename($file)."; 1 = Keep ".basename($prev)."; 2 = Keep both files\nResponse: ";
$line = trim(fgets(fopen("php://stdin","r")));
if(!$line){
echo "Keeping ".basename($file)."\n";
unset($files[array_search($prev,$files)]);
} elseif ($line == 1) {
echo "Keeping file ".basename($prev)."\n";
unset($files[array_search($file,$files)]);
} elseif ($line == 2) {
echo "Keeping both files\n";
} else {
echo "Invalid response, skipping\n";
}
echo "Resuming...\n";
}
}
$i++;
}
echo "\n";
$e = 2; $o = 1;
if ($midpoint_key == "none") {
foreach ($files as $file) {
$new = $input_dir."/".sprintf('%03d',$o)."-".basename($file);
$ops[$o] = array($file,$new);
$o++;
}
} else {
foreach ($files as $file) {
$num = substr($file, -7, 3);
if ($num < $midpoint_key) {
$new = $input_dir."/".sprintf('%03d',$e)."-".basename($file);
$ops[$e] = array($file,$new);
$e = $e+2;
} else {
$new = $input_dir."/".sprintf('%03d',$o)."-".basename($file);
$ops[$o] = array($file,$new);
$o = $o+2;
}
}
}
ksort($ops);
foreach ($ops as $op) {
echo $op[0]." will be renamed ".$op[1]."\n";
}
echo "\nType \"ok\" to skip comparison\n\n";
while (trim(fgets(fopen("php://stdin","r"))) != "ok") {
echo "Press return to compare another spread or type \"ok\" when finished\n\n";
$start = floor(rand(count($ops)-(count($ops)*.2),count($ops))/2)*2;
$left = $ops[$start][0];
$right = $ops[$start+1][0];
exec("open ".$left." ".$right." -b com.apple.Preview");
}
echo "\nMoving files!\n";
foreach ($ops as $key => $op) {
rename($op[0],$op[1]);
}
}
$files = glob($input_dir."/[0-9][0-9][0-9]-*.jpg");
// Apply profile and orientation
if (shell_exec("exiftool -s -s -s -Orientation ".$files[0]." 2>&1")) {
echo "\nOrientation already applied, skipping.\n\n";
} else {
echo "\nApplying XMP profile & orientation: ";
foreach ($files as $file) {
exec("cat ".$xmp_profile." | exiv2 -iXX- ".$file);
if (substr(basename($file), 0, 3) % 2 != 0) {
exec("exiftool -overwrite_original -n -Orientation=3 ".$file);
}
echo ".";
}
echo "\n\n";
}
// Define crop area
while (isset($proceed) != true) {
echo "Set crop areas: [x] to skip, [d] to define, [s] to scan.\n";
$input = trim(fgets(fopen("php://stdin","r")));
switch ($input) {
case "x":
$proceed = 1;
break;
case "s":
echo "Checking Crops: ";
foreach ($files as $file) {
$parts = chop(shell_exec("exiftool -s -s -s -XMP-crs:CropTop -XMP-crs:CropRight -XMP-crs:CropLeft -XMP-crs:CropBottom ".$file." 2>&1"));
@list($top, $right, $left, $bottom) = explode("\n", $parts);
if ($top && $right && $left && $bottom) {
$key = preg_replace("/[^0-9]/","",substr($file, -8, 4));
$crops[$key]['top'] = $top;
$crops[$key]['right'] = $right;
$crops[$key]['left'] = $left;
$crops[$key]['bottom'] = $bottom;
echo "*";
} else {
echo "-";
}
}
$proceed = 1;
break;
case "d":
foreach ($files as $file) {
$seq[preg_replace("/[^0-9]/","",substr($file, -8, 4))] = $file;
}
ksort($seq);
$seg = floor(count($seq)/$multicrops)-1;
$picks = array();
foreach (range(1, $multicrops, 1) as $val) {
$picks[] = array_values(array_slice($seq, $val*$seg, 1))[0];
}
foreach ($picks as $file) {
echo $file."\n";
}
trim(fgets(fopen("php://stdin","r")));
exec("open ".implode(" ",$picks)." -b com.adobe.Photoshop");
break;
}
echo "\n";
}
if (isset($crops) && count($crops) > count($files)/2) {
echo "\nIt looks like multicrop has already been applied, skipping.\n\n";
} elseif (isset($crops) && count($crops)) {
echo "Crop areas have been detected as follows. Press return to write to files.\n";
foreach ($crops as $key => $parts) {
echo "\n";
echo $key."\t\tTop: ".bashcolor($parts['top'], $colors[array_search($key,array_keys($crops))]);
echo "\tRight: ".bashcolor($parts['right'], $colors[array_search($key,array_keys($crops))]);
echo "\tLeft: ".bashcolor($parts['left'], $colors[array_search($key,array_keys($crops))]);
echo "\tBottom: ".bashcolor($parts['bottom'], $colors[array_search($key,array_keys($crops))]);
}
echo "\n";
trim(fgets(fopen("php://stdin","r")));
echo "Crop Mapping:\n";
foreach ($files as $file) {
$key = preg_replace("/[^0-9]/","",substr($file, -8, 4));
$closekey = getClosest($key, array_keys($crops));
$parts = $crops[$closekey];
echo "\n";
echo $file."\t\tTop: ".bashcolor($parts['top'], $colors[array_search($closekey,array_keys($crops))]);
echo "\tRight: ".bashcolor($parts['right'], $colors[array_search($closekey,array_keys($crops))]);
echo "\tLeft: ".bashcolor($parts['left'], $colors[array_search($closekey,array_keys($crops))]);
echo "\tBottom: ".bashcolor($parts['bottom'], $colors[array_search($closekey,array_keys($crops))]);
exec("exiftool -overwrite_original -XMP-crs:HasCrop=1 -XMP-crs:AlreadyApplied=0 -XMP-crs:CropTop=".$parts['top']." -XMP-crs:CropRight=".$parts['right']." -XMP-crs:CropLeft=".$parts['left']." -XMP-crs:CropBottom=".$parts['bottom']." ".$file);
}
echo "\n\n";
}
//Deskew
@@ -1030,11 +994,7 @@ if (shell_exec("exiftool -s -s -s -CropAngle ".$files[0]." 2>&1")) {
}
// Open files
echo "\nFinished! Press return to open all files in Photoshop\n";
fgets(fopen("php://stdin","r"));
exec("open ".implode(" ",$files)." -b com.adobe.Photoshop");
// check bridge labels
// for i in *; do exiftool -s -s -s -Label $i; done