PHP code example of ccmiller2018 / image-editor

1. Go to this page and download the library: Download ccmiller2018/image-editor library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ccmiller2018 / image-editor example snippets


use Ccmiller2018\ImageEditor\ImageEditor;

// Create an instance of ImageEditor
$imageEditor = new ImageEditor();

// Load an image from a file
$imageEditor->loadImage('path/to/image.jpg');

// Perform operations on the image
$imageEditor
    ->resize(300, 200)
    ->grayscale()
    ->saveTo('path/to/output.jpg');



declare(strict_types=1);

use Ccmiller2018\ImageEditor\ImageEditor;

g')
    ->resize(100, 100)
    ->saveTo('images/outputs/baboon-resize-100-100.jpg');



declare(strict_types=1);

use Ccmiller2018\ImageEditor\ImageEditor;

g')
    ->resize(1024, 1024)
    ->saveTo('images/outputs/baboon-resize-1024-1024.jpg');



declare(strict_types=1);

use Ccmiller2018\ImageEditor\ImageEditor;

g')
    ->as('jpeg')
    ->saveTo('images/outputs/baboon.jpg');



declare(strict_types=1);

use Ccmiller2018\ImageEditor\ImageEditor;

g')
    ->grayscale()
    ->saveTo('images/outputs/baboon-grayscale.png');



declare(strict_types=1);

use Ccmiller2018\ImageEditor\ImageEditor;

g')
    ->resize(256, 256)
    ->grayscale()
    ->as('jpeg')
    ->saveTo('images/outputs/baboon-grayscale-resize.jpg');



declare(strict_types=1);

use Ccmiller2018\ImageEditor\ImageEditor;

.jpg')
    ->removeBackground()
    ->saveTo('images/outputs/HappyFish-remove-background.jpg');



declare(strict_types=1);

use Ccmiller2018\ImageEditor\ImageEditor;

g')
    ->negative()
    ->saveTo('images/outputs/baboon-negative.png');



declare(strict_types=1);

use Ccmiller2018\ImageEditor\ImageEditor;

g')
    ->resize(1024, 1024)
    ->posterize()
    ->posterize()
    ->sketch()
    ->grayscale()
    ->adjustBrightness(-30)
    ->adjustContrast(30)
    ->negative()
    ->edgeDetection()
    ->removeBackground(120)
    ->negative()
    ->adjustBrightness(60)
    ->sepia()
    ->saveTo('images/outputs/baboon-complex.png');



declare(strict_types=1);

use Ccmiller2018\ImageEditor\ImageEditor;

00],
    [0,-100,0]
];

$editor->loadImage('images/sources/baboon.png')
    ->customConvolution($matrix)
    ->saveTo('images/outputs/baboon-custom-convolution.png');