Skip to content

Instantly share code, notes, and snippets.

@hyyan
Created November 5, 2017 17:00
Show Gist options
  • Save hyyan/9fe882b18686445f03ef2d003e365d3d to your computer and use it in GitHub Desktop.
Save hyyan/9fe882b18686445f03ef2d003e365d3d to your computer and use it in GitHub Desktop.

Revisions

  1. hyyan created this gist Nov 5, 2017.
    19 changes: 19 additions & 0 deletions Cartoon Outline with PHP Jaguar.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    <?php

    require_once 'vendor/autoload.php';

    use Jaguar\Canvas,
    Jaguar\Transformation,
    Jaguar\Action\Color\Grayscale,
    Jaguar\Action\EdgeDetection,
    Jaguar\Action\Color\Negate;


    $canvas = new Canvas('./image.jpg');
    $canvasTransformation = new Transformation($canvas);
    $canvasTransformation
    ->apply(new Grayscale())
    ->apply(new EdgeDetection(EdgeDetection::LAPLACIAN_FILTER3))
    ->apply(new Negate())
    ->getCanvas()
    ->show(); // send the result to the browser