This commit is contained in:
2019-10-09 14:41:59 -07:00
parent 012aa00ad4
commit 030d024c23
3 changed files with 24 additions and 3 deletions

View File

@@ -3,7 +3,7 @@
// Leaf - Tools for Book Scans
// No license, do not distribute
$version = "0.8.13";
$version = "0.9.0.0";
$time_start = microtime(true);
date_default_timezone_set("America/Los_Angeles");
@@ -76,6 +76,17 @@ function levels_ps_to_imgk($string) {
}
}
function olevels_ps_to_imgk($string) {
$parts = explode(",", $string);
if (count($parts) != 2) {
msg("Invalid levels string",1);
} else {
$black = (number_format(($parts[0]/253),5)*100)."%";
$white = (number_format(($parts[1]/255),5)*100)."%";
return $black.",".$white;
}
}
function unsharp_ps_to_imgk($string) {
$parts = explode(",", $string);
if (count($parts) != 3) {
@@ -180,6 +191,8 @@ function args($query) {
return levels_ps_to_imgk($opt['levels']);
} elseif ($query == "plevels" && isset($opt['plevels'])) {
return levels_ps_to_imgk($opt['plevels']);
} elseif ($query == "olevels" && isset($opt['olevels'])) {
return olevels_ps_to_imgk($opt['olevels']);
} elseif ($query == "unsharp" && isset($opt['unsharp'])) {
return unsharp_ps_to_imgk($opt['unsharp']);
} elseif (isset($opt[$query])) {
@@ -865,7 +878,12 @@ foreach ($jpg as $parts) {
$msg .= " (".args("levels").")";
$cmd .= "-level ".args("levels")." ";
}
if (args("olevels")) {
$msg .= " (".args("olevels").")";
$cmd .= "+level ".args("olevels")." ";
}
if (args("unsharp")) {
$msg .= " (".args("unsharp").")";
$cmd .= "-unsharp ".args("unsharp")." ";