Wallogit.com
2017 © Pedro Peláez
Create an obfuscated version of a source image
This is currently a work in progress and not completly stable. API not yet final so new versions can break code.!, (*1)
Create an obfuscated version of a source image by using a Voronoi diagram (see. https://en.wikipedia.org/wiki/Voronoi_diagram), (*2)
Maybe you feel like making "art" from your images or you just like your images obfuscated, (*3)
Input (200x200px):, (*4)
, (*5)
Results:, (*6)
, (*7)
Reduce Size to 100x100px, (*8)
, (*9)
Non proportional resize to 400x100px, (*10)
, (*11)
Non proportional resize to 100x400px, (*12)
, (*13)
composer require dkerner/voronoi-obfuscate "@dev"
// create an obfuscated version of demo.jpg, store it as out.jpg
// and create 500 points
VoronoiObfuscator::createFromImagePath('demo.jpg', 'out.jpg', 500);
// use config and resize the resulting image
$config = new ObfuscatorConfig();
$config->setImagePath('demo.jpg')
->setOutputPath('out.jpg')
->setCellCount(1000)
->setOutputSize(400,800);
VoronoiObfuscator::createFromConfig($config);
Or use an image resource as input and output, (*14)
$config = new ObfuscatorConfig(); // set input $imageRessource = imagecreatefromjpeg('demo.jpg'); $config->setInputResource( $imageRessource ) ->setCellCount(100) ->setOutputSize(100,100); $processedImageRessource = VoronoiObfuscator::processImage($config); // use it further however needed imagejpeg( $processedImageRessource, 'out_processed.jpg');
This project is licensed under the MIT License - see the LICENSE file for details, (*15)