PHP code example of mion / dither

1. Go to this page and download the library: Download mion/dither library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mion / dither example snippets


use Dither\Dither;

$image = imagecreatefrompng('demo.png');

$dither = new Dither;
$dither->setPalette(['#000000', '#FFFFFF', '#00FF00', '#0000FF', '#FF0000', '#FFFF00', '#FF8000']);
$output = $dither->process($image, 800, 600);