This is currently a work in progress and not completly stable. API not yet final so new versions can break code.!
Create an obfuscated version of a source image by using a Voronoi diagram (see. https://en.wikipedia.org/wiki/Voronoi_diagram)
Maybe you feel like making "art" from your images or you just like your images obfuscated
Input (200x200px):
Results:
Reduce Size to 100x100px
Non proportional resize to 400x100px
Non proportional resize to 100x400px
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
$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');
- Daniel Kerner - dkerner
This project is licensed under the MIT License - see the LICENSE file for details
- https://github.com/sroze with the sroze/PHP-Voronoi-algorithm example which was a great starting point and whose Nurbs classes are used at the moment
- https://github.com/zippex who needed the image obfuscation