Summary
Description: Phoronix Test Suite open-source benchmarking development
Last Change: Tue 5/21/13 15:49
Recent Commits
>
--git a/CHANGE-LOG b/CHANGE-LOG
index d72b12b..5d73d14 100644
--- a/CHANGE-LOG
+++ b/CHANGE-LOG
@@ -7,6 +7,7 @@ Phoronix Test Suite (Git)
- pts-core: Disable webui since it won't be ready until PTS 4.2
- phodevi: Additional fall-back support when GPU driver doesn't expose all standard mode-setting modes
- timed_screenshot: Overhaul of the timed screenshot PTS module
+- timed_screenshot: Compress PNG images
Phoronix Test Suite 4.0 Milestone 4
29 June 2012
diff --git a/pts-core/modules/timed_screenshot.php b/pts-core/modules/timed_screenshot.php
index 8326e75..5032790 100644
--- a/pts-core/modules/timed_screenshot.php
+++ b/pts-core/modules/timed_screenshot.php
@@ -76,7 +76,15 @@ class timed_screenshot extends pts_module_interface
public static function __post_test_run()
{
pts_module::remove_file('is_running');
- return self::$screenshots;
+ $screenshots = self::get_screenshots();
+
+ foreach($screenshots as $screenshot)
+ {
+ // Compress the PNGs a bit
+ pts_image::compres_png_image($screenshot, 9);
+ }
+
+ return $screenshots;
}
public static function take_screenshot($force = false)
{
diff --git a/pts-core/objects/pts_image.php b/pts-core/objects/pts_image.php
index 3565ada..3dc71d5 100644
--- a/pts-core/objects/pts_image.php
+++ b/pts-core/objects/pts_image.php
@@ -131,6 +131,19 @@ class pts_image
return $color;
}
+ public static function compres_png_image($png_file, $compression_level = 8)
+ {
+ $img = imagecreatefrompng($png_file);
+
+ if($img)
+ {
+ imagepng($img, $png_file, $compression_level);
+ imagedestroy($img);
+ return true;
+ }
+
+ return false;
+ }
}
Copyright © 2013 by Phoronix Media