Support » Plugin: Square Thumbnails » Sharpen Thumbnails

  • Thanks for the great little plugin – it does the job!:)
    I noticed that generated thumbnails appear quite fuzzy.

    I added a bit of sharpening for jpeg output:

    private function saveIm($mime,&$newim,$f){
    if($mime==’image/png’){
    imagepng($newim, $f);
    }
    elseif($mime==’image/jpeg’){

    // define the sharpen matrix
    $sharpen = array(
    array(0.0, -1.0, 0.0),
    array(-1.0, 9.5, -1.0),
    array(0.0, -1.0, 0.0)
    );

    // calculate the sharpen divisor
    $divisor = array_sum(array_map(‘array_sum’, $sharpen));

    // apply the matrix
    imageconvolution($newim, $sharpen, $divisor, 0);

    imagejpeg($newim, $f, 80); //changed quality to 80
    }
    elseif($mime==’image/bmp’){
    imagebmp($newim, $f);
    }
    elseif($mime==’image/gif’){
    imagegifg($newim, $f);
    }
    elseif($mime==’image/vnd.wap.wbmp’){
    imagewbmp($newim, $f);
    }
    }

  • The topic ‘Sharpen Thumbnails’ is closed to new replies.