diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..9e121d3 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,3 @@ +[0.9.0.0] + +- Added negative levels option \ No newline at end of file diff --git a/current_version.txt b/current_version.txt index a83f796..ef3d8e2 100644 --- a/current_version.txt +++ b/current_version.txt @@ -1 +1 @@ -0.8.13.0 \ No newline at end of file +0.9.0.0 \ No newline at end of file diff --git a/leaf.php b/leaf.php index 7cfcc2d..d2d1484 100644 --- a/leaf.php +++ b/leaf.php @@ -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")." ";