0.6.1
This commit is contained in:
18
leaf.php
18
leaf.php
@@ -2,7 +2,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
// Leaf - Tools for Book Scans
|
// Leaf - Tools for Book Scans
|
||||||
$version = "0.6.0";
|
$version = "0.6.1";
|
||||||
$time_start = microtime(true);
|
$time_start = microtime(true);
|
||||||
|
|
||||||
// Functions
|
// Functions
|
||||||
@@ -173,22 +173,32 @@ echo Welcome("Batch set EXIF resolution tags");
|
|||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
$files = glob(args("dir")."*.*");
|
$files = glob(args("dir")."*.*");
|
||||||
if (null !== args("x")) {
|
|
||||||
|
if (args("height")) {
|
||||||
|
$height = args("height");
|
||||||
|
} elseif (args("x")) {
|
||||||
$x = args("x");
|
$x = args("x");
|
||||||
} else {
|
} else {
|
||||||
msg("No resolution value",1);
|
msg("No resolution value",1);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($files as $file) {
|
foreach ($files as $file) {
|
||||||
echo "Processing ".$file;
|
echo "Processing ".$file.": ";
|
||||||
$ext = pathinfo($file, PATHINFO_EXTENSION);
|
$ext = pathinfo($file, PATHINFO_EXTENSION);
|
||||||
|
if ($height) {
|
||||||
|
list ($imwidth, $imheight) = getimagesize($file);
|
||||||
|
$x = floor($imheight/$height);
|
||||||
|
}
|
||||||
if ($ext == "jpg" | $ext == "JPG") {
|
if ($ext == "jpg" | $ext == "JPG") {
|
||||||
exec("exiftool -overwrite_original -Xresolution=".$x." -Yresolution=".$x." ".$file);
|
exec("exiftool -overwrite_original -Xresolution=".$x." -Yresolution=".$x." -jfif:Xresolution=".$x." -jfif:Yresolution=".$x." ".$file);
|
||||||
|
echo "set DPI to ".$x;
|
||||||
} elseif ($ext == "DNG") {
|
} elseif ($ext == "DNG") {
|
||||||
exec("exiftool -overwrite_original -Xresolution=".$x." -Yresolution=".$x." -SubIFD:Xresolution=".$x." -SubIFD:Yresolution=".$x." -SubIFD1:Xresolution=".$x." -SubIFD1:Yresolution=".$x." ".$file);
|
exec("exiftool -overwrite_original -Xresolution=".$x." -Yresolution=".$x." -SubIFD:Xresolution=".$x." -SubIFD:Yresolution=".$x." -SubIFD1:Xresolution=".$x." -SubIFD1:Yresolution=".$x." ".$file);
|
||||||
|
echo "set DPI to ".$x;
|
||||||
} elseif ($ext == "png") {
|
} elseif ($ext == "png") {
|
||||||
$res = $x*39.37007874016;
|
$res = $x*39.37007874016;
|
||||||
exec("exiftool -overwrite_original -PixelsPerUnitX=".$res." -PixelsPerUnitY=".$res." ".$file);
|
exec("exiftool -overwrite_original -PixelsPerUnitX=".$res." -PixelsPerUnitY=".$res." ".$file);
|
||||||
|
echo "set DPI to ".$res;
|
||||||
} else {
|
} else {
|
||||||
echo " -> skip";
|
echo " -> skip";
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user