Sharpen

Here is some information on how to sharpen the thumbnails. When a picture is resized down a lot, it becomes somewhat blurry. Some users do find it necessary to additionally sharpen the thumbnails.

Note that this function may only be useful to users of the PHP-GD library. If you are using ImageMagick, the thumbnails are already sharpened with the default command line.

Installation

You need a working Thumblist² series installation.

For PHP 5.1 or newer with Thumblist version 20081015 or newer

The code was added to the Thumblist core (borrowed from Mini); you don't need to do anything. (You may need to purge your existing thumbnails to let the program regenerate them sharper.)

From version 20100215 on, you can specify the force of the "sharpness", by adding to local/config.php such a line:

 $ThumbList['Sharpen'] = 9;

Default sharpness is set to 16; setting it to 9 will create sharper thumbnails, setting it for example to 24 will create less sharp thumbnails. (If you change this setting, you may need to purge your existing thumbnails to let the program regenerate them.)

This setting is the "center" value of the convolution matrix, and the divisor is calculated automatically. Reference.

For PHP 5.1 or newer with Thumblist versions older than 20081015

I just found this while investigating for the Mini recipe which is PHP only.

From PHP 5.1 on, there is the function imageconvolution and the thumbnails can be sharpened quickly and easily. This is the easiest and fastest way to sharpen pictures with PHP 5.1.

Add the following code to your config.php:

$ThumbList['fProcessGD'] = 'uThumbConvolution';
function uThumbConvolution($im)
{
  $mx = array(array(-1,-1,-1),array(-1,16,-1),array(-1,-1,-1));
  imageconvolution($im,$mx,8,0);
  return $im;
}

The method with imageconvolution is integrated in the Mini gallery.

For older versions of PHP : phpUnsharpMask

This is a function found at http://vikjavev.no/computing/ump.php?id=35 which I adapted for Thumblist

  1. Copy the file thumblist2-sharpen.txt in your cookbook directory (rename it to thumblist2-sharpen.php).
  2. Add this code to your config.php:
if($action=="createthumb")
  {include_once("$FarmD/cookbook/thumblist2-sharpen.php");}

Note that using this function may be noticeably slower for the server to generate many thumbnails. Once they are generated, it should be OK.

Enjoy.