Skip to content
This repository has been archived by the owner on Apr 24, 2020. It is now read-only.

thekonz/piximgen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PixImGen

Pixel graphics library for PHP.

Installation

Add this to your composer.json:

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

Then run composer install or composer update.

Example app

Wanna try it out? Take a look at the example app.

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

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

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.

About

Pixel graphics library for PHP.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages