Realise of a PHP script that can manipulate an image source and create images with a pixel style. Research and study with the use of the GD library.
fileName (string) : Source of image. nbrPoint (int) : The nunmber of pixel that you want to take in the picture. shape (string) : The shape, for the moment only rect is available. rangeSizeShape (array:int) : Range of size for the rect shape in pixel. minOpacity : The mininum opacity for shape, in percent. lowerizationLvl (int) : If this number is large then the large size will be rare borderLess (bool) : True, then the edge detection is done and similar color pixels are not taken, typically use when the images are on a solid background.
PHP & GD
Load the script with URL of this
//params for class
$params = array(
"fileName" => "pikachu.jpg",
"nbrPoint" => 10000,
"shape" => "rect",
"rangeSizeShape" => array(0,50),
"minOpacity" => 30, //0 = hide | 100 = visible
"lowerizationLvl" => 3,
"borderLess" => true,
"exportMode" => "display",
"randomColor" => false
);
//launch object
$imageRendering = new pixelArt($params);
$imageRendering->collectPixel();
$imageRendering->makingShape();
Use animated params for making gif picture.
$params = array(
"fileName" => "sangoku.jpg",
"nbrPoint" => 20000,
"shape" => "rect",
"rangeSizeShape" => array(0,20),
"minOpacity" => 30, //0 = hide | 100 = visible
"lowerizationLvl" => 2,
"borderLess" => true,
"exportMode" => "display",
"animated" => array(
"nbrImage" => 3,
"timerInterval" => 100
)
);
//launch object
$imageRendering = new pixelArt($params);
$imageRendering->makingAnimation();
- rect (rectangle)
- triangle
- diamond
- sandglass