0.9.0.2
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
- Option to mix levels adjustment with original
|
- Option to mix levels adjustment with original
|
||||||
- Removed "a" flag from trash command
|
- Removed "a" flag from trash command
|
||||||
|
- Tweak to PNG dimensions
|
||||||
|
|
||||||
[0.9.0.1]
|
[0.9.0.1]
|
||||||
|
|
||||||
|
|||||||
25
leaf.php
25
leaf.php
@@ -154,7 +154,7 @@ function fin($print = null) {
|
|||||||
if (isset($print)) {
|
if (isset($print)) {
|
||||||
echo "\n".$print;
|
echo "\n".$print;
|
||||||
}
|
}
|
||||||
$finished = "\nFinished in ".floor($time = microtime(true)-$_SERVER["REQUEST_TIME_FLOAT"])." seconds\n\n";
|
$finished = "\nFinished in ".round($time = microtime(true)-$_SERVER["REQUEST_TIME_FLOAT"])." seconds\n\n";
|
||||||
file_put_contents("leaf.log",$finished,FILE_APPEND);
|
file_put_contents("leaf.log",$finished,FILE_APPEND);
|
||||||
die;
|
die;
|
||||||
}
|
}
|
||||||
@@ -806,28 +806,29 @@ $ratioavg = number_format(array_sum($dims)/count($dims),3);
|
|||||||
echo "Average page ratio: ".$ratioavg;
|
echo "Average page ratio: ".$ratioavg;
|
||||||
if ($ratioavg > 1) { // page is tall
|
if ($ratioavg > 1) { // page is tall
|
||||||
$page_height = $pixels;
|
$page_height = $pixels;
|
||||||
$page_width = floor($page_height/$ratioavg);
|
$page_width = round($page_height/$ratioavg);
|
||||||
$paper_height = $inches;
|
$paper_height = $inches;
|
||||||
$paper_width = number_format($paper_height/$ratioavg,2);
|
$paper_width = number_format($paper_height/$ratioavg,2);
|
||||||
} else {
|
} else {
|
||||||
$page_width = $pixels;
|
$page_width = $pixels;
|
||||||
$page_height = floor($page_width*$ratioavg);
|
$page_height = round($page_width*$ratioavg);
|
||||||
$paper_width = $inches;
|
$paper_width = $inches;
|
||||||
$paper_height = number_format($paper_width*$ratioavg,2);
|
$paper_height = number_format($paper_width*$ratioavg,2);
|
||||||
}
|
}
|
||||||
|
|
||||||
$dpi = number_format($page_height/$paper_height,2);
|
$dpi = round($page_height/$paper_height,3);
|
||||||
$canonicalpngdpi = number_format($dpi*$multiplier,2);
|
$canonicalpngdpi = round($dpi)*$multiplier;
|
||||||
$pngdpi = $canonicalpngdpi*39.37007874016;
|
$pngdpi = round($canonicalpngdpi*39.37007874016);
|
||||||
$dims = $page_width."x".$page_height;
|
$dims = $page_width."x".$page_height;
|
||||||
$pngdims = ($page_width*$multiplier)."x".($page_height*$multiplier);
|
// png dpi does not accept decimal points, so we will adjust the png dims slightly to better match jpg size
|
||||||
|
$pngdims = (round($canonicalpngdpi*$paper_width))."x".(round($canonicalpngdpi*$paper_height));
|
||||||
|
|
||||||
echo "\n";
|
echo "\n";
|
||||||
echo "Page size: ".$paper_width."\" x ".$paper_height."\"";
|
echo "Page size: ".$paper_width."\" x ".$paper_height."\"";
|
||||||
echo "\n";
|
echo "\n";
|
||||||
echo "Target pixel dimensions: ".$dims." (png=".$pngdims.")";
|
echo "Target pixel dimensions: ".$dims." (png=".$pngdims.")";
|
||||||
echo "\n";
|
echo "\n";
|
||||||
echo "DPI = ".$dpi." (png=".$canonicalpngdpi.")";
|
echo "DPI = ".$dpi." (png=".$pngdpi.")";
|
||||||
|
|
||||||
foreach ($color as $parts) {
|
foreach ($color as $parts) {
|
||||||
$jpg[] = $parts;
|
$jpg[] = $parts;
|
||||||
@@ -893,7 +894,7 @@ foreach ($jpg as $parts) {
|
|||||||
$levelcmd .= "-modulate ".args("modulate")." ";
|
$levelcmd .= "-modulate ".args("modulate")." ";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args("mix") && $levelcmd) {
|
if (args("mix") && $levelcmd && $iscolor) {
|
||||||
// if this is a mix, we reset the $cmd so we can nest the levels command and mix with og
|
// if this is a mix, we reset the $cmd so we can nest the levels command and mix with og
|
||||||
$msg .= " <MIX=".args("mix").">";
|
$msg .= " <MIX=".args("mix").">";
|
||||||
$cmd = "convert \( ".$file." -resize ".$dims."\! ".$levelcmd."\) \( ".$file." -resize ".$dims."\! \) -define compose:args=".args("mix")." -compose blend -composite ";
|
$cmd = "convert \( ".$file." -resize ".$dims."\! ".$levelcmd."\) \( ".$file." -resize ".$dims."\! \) -define compose:args=".args("mix")." -compose blend -composite ";
|
||||||
@@ -909,7 +910,7 @@ foreach ($jpg as $parts) {
|
|||||||
$msg .= " [Q=".$quality."]";
|
$msg .= " [Q=".$quality."]";
|
||||||
$cmd .= "-quality ".$quality." ";
|
$cmd .= "-quality ".$quality." ";
|
||||||
|
|
||||||
if (args("mix") && $levelcmd) {
|
if (args("mix") && $levelcmd && $iscolor) {
|
||||||
$cmd .= $output;
|
$cmd .= $output;
|
||||||
} else {
|
} else {
|
||||||
$cmd .= $file." ".$output;
|
$cmd .= $file." ".$output;
|
||||||
@@ -1588,7 +1589,7 @@ foreach ($files as $file) {
|
|||||||
}
|
}
|
||||||
$print[] = bashcolor($attr['Image Width']."x".$attr['Image Height'], $color);
|
$print[] = bashcolor($attr['Image Width']."x".$attr['Image Height'], $color);
|
||||||
if (isset($attr['X Resolution'])) {
|
if (isset($attr['X Resolution'])) {
|
||||||
$print[] = bashcolor(floor($attr['X Resolution']).":".floor($attr['Y Resolution']), "brown");
|
$print[] = bashcolor(round($attr['X Resolution']).":".round($attr['Y Resolution']), "brown");
|
||||||
$width = number_format($attr['Image Width']/$attr['X Resolution'],2);
|
$width = number_format($attr['Image Width']/$attr['X Resolution'],2);
|
||||||
$height = number_format($attr['Image Height']/$attr['Y Resolution'],2);
|
$height = number_format($attr['Image Height']/$attr['Y Resolution'],2);
|
||||||
$print[] = bashcolor($width."\" x ".$height."\"", "white", "black");
|
$print[] = bashcolor($width."\" x ".$height."\"", "white", "black");
|
||||||
@@ -1836,7 +1837,7 @@ foreach ($files as $file) {
|
|||||||
$ext = pathinfo($file, PATHINFO_EXTENSION);
|
$ext = pathinfo($file, PATHINFO_EXTENSION);
|
||||||
if (isset($height)) {
|
if (isset($height)) {
|
||||||
list ($imwidth, $imheight) = getimagesize($file);
|
list ($imwidth, $imheight) = getimagesize($file);
|
||||||
$x = floor($imheight/$height);
|
$x = round($imheight/$height);
|
||||||
}
|
}
|
||||||
if ($ext == "jpg" || $ext == "JPG") {
|
if ($ext == "jpg" || $ext == "JPG") {
|
||||||
exec("exiftool -overwrite_original -Xresolution=".$x." -Yresolution=".$x." -jfif:Xresolution=".$x." -jfif:Yresolution=".$x." ".$file);
|
exec("exiftool -overwrite_original -Xresolution=".$x." -Yresolution=".$x." -jfif:Xresolution=".$x." -jfif:Yresolution=".$x." ".$file);
|
||||||
|
|||||||
Reference in New Issue
Block a user