0.6.3
This commit is contained in:
37
leaf.php
37
leaf.php
@@ -2,7 +2,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
// Leaf - Tools for Book Scans
|
// Leaf - Tools for Book Scans
|
||||||
$version = "0.6.2";
|
$version = "0.6.3";
|
||||||
$time_start = microtime(true);
|
$time_start = microtime(true);
|
||||||
|
|
||||||
// Functions
|
// Functions
|
||||||
@@ -33,7 +33,7 @@ function args($query) {
|
|||||||
$parts = explode("=", $value);
|
$parts = explode("=", $value);
|
||||||
$opt[trim($parts[0],"-")] = isset($parts[1]) ? $parts[1] : 1;
|
$opt[trim($parts[0],"-")] = isset($parts[1]) ? $parts[1] : 1;
|
||||||
}
|
}
|
||||||
if ($query == "app") {
|
if ($query == "app" && isset($argv[1])) {
|
||||||
return $argv[1];
|
return $argv[1];
|
||||||
} elseif ($query == "dir") {
|
} elseif ($query == "dir") {
|
||||||
return chop($argv[count($argv)-1], "/")."/";
|
return chop($argv[count($argv)-1], "/")."/";
|
||||||
@@ -78,7 +78,7 @@ function bashcolor($str,$fgcolor="white",$bgcolor=null) {
|
|||||||
|
|
||||||
// Checks
|
// Checks
|
||||||
|
|
||||||
if (!is_dir(args("dir"))) {
|
if (args("dir") && !is_dir(args("dir"))) {
|
||||||
msg("Problem with working dir: ".args("dir"), 1);
|
msg("Problem with working dir: ".args("dir"), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,10 +86,31 @@ if (!is_dir("scratch")) {
|
|||||||
mkdir("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
|
// Review: output a table of stats on source images
|
||||||
//////////////////////
|
//////////////////////
|
||||||
if (args("app") == "review") {
|
} elseif (args("app") == "review") {
|
||||||
echo Welcome("List image statistics");
|
echo Welcome("List image statistics");
|
||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@@ -180,8 +201,9 @@ if (file_exists($dest)) {
|
|||||||
}
|
}
|
||||||
echo "Creating pdf...\n\n";
|
echo "Creating pdf...\n\n";
|
||||||
exec("img2pdf --verbose --viewer-page-layout twocolumnright --output ".$dest." ".$input);
|
exec("img2pdf --verbose --viewer-page-layout twocolumnright --output ".$dest." ".$input);
|
||||||
|
echo "\n";
|
||||||
msg("Press return to open in Acrobat",2);
|
msg("Press return to open in Acrobat",2);
|
||||||
exec("open ".$dest." -b com.adobe.Acrobat");
|
exec("open ".$dest." -b com.adobe.Acrobat.Pro");
|
||||||
|
|
||||||
fin();
|
fin();
|
||||||
|
|
||||||
@@ -205,7 +227,7 @@ if (args("height")) {
|
|||||||
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) {
|
if (isset($height)) {
|
||||||
list ($imwidth, $imheight) = getimagesize($file);
|
list ($imwidth, $imheight) = getimagesize($file);
|
||||||
$x = floor($imheight/$height);
|
$x = floor($imheight/$height);
|
||||||
}
|
}
|
||||||
@@ -677,4 +699,7 @@ exec("open ".implode(" ",$files)." -b com.adobe.Photoshop");
|
|||||||
// check bridge labels
|
// check bridge labels
|
||||||
// for i in *; do exiftool -s -s -s -Label $i; done
|
// for i in *; do exiftool -s -s -s -Label $i; done
|
||||||
|
|
||||||
|
// convert to sRGB lossy
|
||||||
|
// jpegicc -q100 001-Plustek0001.jpg 001-Plustek0001_out.jpg
|
||||||
|
|
||||||
?>
|
?>
|
||||||
Reference in New Issue
Block a user