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

3
CHANGELOG.md Normal file
View File

@@ -0,0 +1,3 @@
[0.9.0.0]
- Added negative levels option

View File

@@ -1 +1 @@
0.8.13.0 0.9.0.0

View File

@@ -3,7 +3,7 @@
// Leaf - Tools for Book Scans // Leaf - Tools for Book Scans
// No license, do not distribute // No license, do not distribute
$version = "0.8.13"; $version = "0.9.0.0";
$time_start = microtime(true); $time_start = microtime(true);
date_default_timezone_set("America/Los_Angeles"); 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) { function unsharp_ps_to_imgk($string) {
$parts = explode(",", $string); $parts = explode(",", $string);
if (count($parts) != 3) { if (count($parts) != 3) {
@@ -180,6 +191,8 @@ function args($query) {
return levels_ps_to_imgk($opt['levels']); return levels_ps_to_imgk($opt['levels']);
} elseif ($query == "plevels" && isset($opt['plevels'])) { } elseif ($query == "plevels" && isset($opt['plevels'])) {
return levels_ps_to_imgk($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'])) { } elseif ($query == "unsharp" && isset($opt['unsharp'])) {
return unsharp_ps_to_imgk($opt['unsharp']); return unsharp_ps_to_imgk($opt['unsharp']);
} elseif (isset($opt[$query])) { } elseif (isset($opt[$query])) {
@@ -866,6 +879,11 @@ foreach ($jpg as $parts) {
$cmd .= "-level ".args("levels")." "; $cmd .= "-level ".args("levels")." ";
} }
if (args("olevels")) {
$msg .= " (".args("olevels").")";
$cmd .= "+level ".args("olevels")." ";
}
if (args("unsharp")) { if (args("unsharp")) {
$msg .= " (".args("unsharp").")"; $msg .= " (".args("unsharp").")";
$cmd .= "-unsharp ".args("unsharp")." "; $cmd .= "-unsharp ".args("unsharp")." ";