0.8.13
This commit is contained in:
27
leaf.php
27
leaf.php
@@ -1,10 +1,9 @@
|
||||
<?php
|
||||
|
||||
// Leaf - Tools for Book Scans
|
||||
// Artways, LLC
|
||||
// No license, do not distribute
|
||||
|
||||
$version = "0.8.12";
|
||||
$version = "0.8.13";
|
||||
$time_start = microtime(true);
|
||||
date_default_timezone_set("America/Los_Angeles");
|
||||
|
||||
@@ -17,6 +16,12 @@ if (in_array($cores,$reasonable_cores)) {
|
||||
} else {
|
||||
$xt = 2;
|
||||
}
|
||||
|
||||
// Simple log
|
||||
|
||||
$message = date("Y-m-d_H-i-s", time())." (".$version.")\n".implode(" ",$argv);
|
||||
file_put_contents("leaf.log",$message,FILE_APPEND);
|
||||
|
||||
// Functions
|
||||
|
||||
function crop_imgk_to_xmp($cwidth, $cheight, $xoff, $yoff, $width, $height) {
|
||||
@@ -136,7 +141,8 @@ function fin($print = null) {
|
||||
if (isset($print)) {
|
||||
echo "\n".$print;
|
||||
}
|
||||
echo "\nFinished in ".floor($time = microtime(true)-$_SERVER["REQUEST_TIME_FLOAT"])." seconds\n\n";
|
||||
$finished = "\nFinished in ".floor($time = microtime(true)-$_SERVER["REQUEST_TIME_FLOAT"])." seconds\n\n";
|
||||
file_put_contents("leaf.log",$finished,FILE_APPEND);
|
||||
die;
|
||||
}
|
||||
|
||||
@@ -297,8 +303,6 @@ generate create final jpg images for pdf creation
|
||||
-skipb skip bitmap images
|
||||
match move files and set crop values to match source dir
|
||||
-source=<dir> read FROM dir
|
||||
notes save leaf shell history to text file
|
||||
-lines=<num> (100) lines to read from bash_history
|
||||
profile apply xmp profile to images (requires exiv2 > 0.25)
|
||||
-file=<file> xmp profile
|
||||
resort reorder image sequence by adding a new image
|
||||
@@ -313,6 +317,7 @@ setdpi set image dpi with exiftool
|
||||
-height=<inches> calculate dpi from specified height
|
||||
sort sort files as AAABBB -> ABABAB
|
||||
-m=<num> (auto) specify midpoint (cover image)
|
||||
-prerotated images are already rotated
|
||||
strip strip exif crop values from images with exiftool
|
||||
|
||||
";
|
||||
@@ -1151,15 +1156,23 @@ if (args("m")) {
|
||||
|
||||
$e = 2; $o = 1;
|
||||
|
||||
if (args("prerotated")) {
|
||||
$leftrotation = 1;
|
||||
$rightrotation = 3;
|
||||
} else {
|
||||
$leftrotation = 8;
|
||||
$rightrotation = 6;
|
||||
}
|
||||
|
||||
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);
|
||||
$ops[$e] = array($file,$new,$leftrotation);
|
||||
$e = $e+2;
|
||||
} else {
|
||||
$new = args("dir").sprintf('%03d',$o)."-".basename($file);
|
||||
$ops[$o] = array($file,$new,6);
|
||||
$ops[$o] = array($file,$new,$rightrotation);
|
||||
$o = $o+2;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user