2017 © Pedro Peláez
 

library piximgen

Pixel graphics library for PHP.

image

thekonz/piximgen

Pixel graphics library for PHP.

  • Tuesday, March 18, 2014
  • by thekonz
  • Repository
  • 1 Watchers
  • 9 Stars
  • 18 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

PixImGen

Pixel graphics library for PHP., (*1)

Installation

Add this to your composer.json:, (*2)

{
    "require": {
        "thekonz/piximgen": "1.0.*@dev"
    }
}

Then run composer install or composer update., (*3)

Example app

Wanna try it out? Take a look at the example app., (*4)

General usage (salute!)

  • Load the composer autoloader.
require_once 'vendor/autoload.php';
  • Create a new instance of PixImGen.
$image = new \thekonz\PixImGen();
  • Set the settings for the image (the constructor also accepts settings as a parameter). You don't have to set the settings at all, there are default settings.
$image->setSettings([
    'seed' => 'GitHub rocks!'
]);
  • Set the header.
header('content-type: image/png');
  • Display the image.
echo $image->getImage();
  • Look at your image!

Image, (*5)

If you play around with the settings (especially the saturation settings), you can get some pretty cool images., (*6)

Complete list of settings

Setting Explanation Default value
seed Starting value for the random generator. Just like in Minecraft. System time (time())
blocksize The width of each block (pixel). 15
width The amount of blocks on the X-axis of the image. 10
height The amount of blocks on the Y-axis of the image. 10
minredsaturation The minimum saturation of the color red. 0
maxredsaturation The maximum saturation of the color red. 255
mingreensaturation The minimum saturation of the color green. 0
maxgreensaturation The maximum saturation of the color green. 255
minbluesaturation The minimum saturation of the color blue. 0
maxbluesaturation The maximum saturation of the color blue. 255

Further manipulation of the image

Since the method getImage() returns an Imagick object, you can use all of the Imagick methods., (*7)

The Versions

18/03 2014

dev-master

9999999-dev

Pixel graphics library for PHP.

  Sources   Download

MIT

The Requires

  • ext-imagick *
  • php >=5.3.0

 

piximgen thekonz