This commit is contained in:
2019-05-07 01:51:48 -07:00
parent 02f848cb55
commit 1e496c1d0e

View File

@@ -2,7 +2,7 @@
<?php
// Leaf - Tools for Book Scans
$version = "0.6.2";
$version = "0.6.3";
$time_start = microtime(true);
// Functions
@@ -33,7 +33,7 @@ function args($query) {
$parts = explode("=", $value);
$opt[trim($parts[0],"-")] = isset($parts[1]) ? $parts[1] : 1;
}
if ($query == "app") {
if ($query == "app" && isset($argv[1])) {
return $argv[1];
} elseif ($query == "dir") {
return chop($argv[count($argv)-1], "/")."/";
@@ -78,7 +78,7 @@ function bashcolor($str,$fgcolor="white",$bgcolor=null) {
// Checks
if (!is_dir(args("dir"))) {
if (args("dir") && !is_dir(args("dir"))) {
msg("Problem with working dir: ".args("dir"), 1);
}
@@ -86,10 +86,31 @@ if (!is_dir("scratch")) {
mkdir("scratch");
}
////////////////////////////////////////////////////////////////////////////////////////////////
// Help
//////////////////////
if (!args("app")) {
/////////////////////////////////////////////////////////////////////////
$help = "Leaf $version
USAGE: leaf [mode] [-options] directory
Modes:
review print a table of image statistics
dpiset set image dpi
-x=<dpi> specify dpi
-height=<inches> calculate dpi from specified height
makepdf combine images into a pdf
stripcrop strip exif crop values from images
";
echo $help;
fin();
////////////////////////////////////////////////////////////////////////////////////////////////
// Review: output a table of stats on source images
//////////////////////
if (args("app") == "review") {
} elseif (args("app") == "review") {
echo Welcome("List image statistics");
/////////////////////////////////////////////////////////////////////////
@@ -180,8 +201,9 @@ if (file_exists($dest)) {
}
echo "Creating pdf...\n\n";
exec("img2pdf --verbose --viewer-page-layout twocolumnright --output ".$dest." ".$input);
echo "\n";
msg("Press return to open in Acrobat",2);
exec("open ".$dest." -b com.adobe.Acrobat");
exec("open ".$dest." -b com.adobe.Acrobat.Pro");
fin();
@@ -205,7 +227,7 @@ if (args("height")) {
foreach ($files as $file) {
echo "Processing ".$file.": ";
$ext = pathinfo($file, PATHINFO_EXTENSION);
if ($height) {
if (isset($height)) {
list ($imwidth, $imheight) = getimagesize($file);
$x = floor($imheight/$height);
}
@@ -677,4 +699,7 @@ exec("open ".implode(" ",$files)." -b com.adobe.Photoshop");
// check bridge labels
// for i in *; do exiftool -s -s -s -Label $i; done
// convert to sRGB lossy
// jpegicc -q100 001-Plustek0001.jpg 001-Plustek0001_out.jpg
?>