diff --git a/adaptive-images.php b/adaptive-images.php index 1d51420..54b0f8f 100755 --- a/adaptive-images.php +++ b/adaptive-images.php @@ -171,7 +171,10 @@ function generateImage($source_file, $cache_file, $resolution) { imagefilledrectangle($dst, 0, 0, $new_width, $new_height, $transparent); } + // invert the image to prevent atrifacts on white areas + imagefilter($src, IMG_FILTER_NEGATE); ImageCopyResampled($dst, $src, 0, 0, 0, 0, $new_width, $new_height, $width, $height); // do the resize in memory + imagefilter($dst, IMG_FILTER_NEGATE); ImageDestroy($src); // sharpen the image? @@ -319,4 +322,4 @@ function generateImage($source_file, $cache_file, $resolution) { /* It exists as a source file, and it doesn't exist cached - lets make one: */ $file = generateImage($source_file, $cache_file, $resolution); -sendImage($file, $browser_cache); \ No newline at end of file +sendImage($file, $browser_cache);