Drawing Images using Core Functionality in PHP

Aspose.Imaging - Drawing Images using Core Functionality

To Draw Images using Core Functionality using Aspose.Imaging Java for PHP, simply invoke DrawingImagesUsingCoreFunctionality module. Here you can see example code.

PHP Code

 # Create an instance of BmpOptions and set its various properties

$create_options = new BmpOptions();


\# Create an instance of FileCreateSource and assign it to Source property

$fileCreateSource=new FileCreateSource();

$create_options->setSource(new FileCreateSource($dataDir . "sample.bmp",false));

\# Create an instance of RasterImage

$image=new Image();

$raster_image = $image->create($create_options,500,500);

\# Get the pixels of the image by specifying the area as image boundary

$pixels = $raster_image->loadPixels($raster_image->getBounds());

$index = 0;

while ($index < sizeof($pixels)) {

\# Set the indexed pixel color to yellow

$color = new Color();

$pixels[$index] = $color->getYellow();

$index += 1;


$raster_image->savePixels($raster_image->getBounds(), $pixels);

\# save all changes


print "Draw Images Using Core Functionality.".PHP_EOL;


Download Running Code

Download Drawing Images using Core Functionality (Aspose.Imaging) from any of the below mentioned social coding sites: