<?php
declare(strict_types=1);

$image = imagecreatetruecolor(8, 6);
$white = imagecolorallocate($image, 255, 255, 255);
imagefill($image, 0, 0, $white);
$red = imagecolorallocate($image, 255, 0, 0);
imagefilledrectangle($image, 2, 1, 5, 4, $red);
$crop = imagecropauto($image, IMG_CROP_WHITE);
echo imagesx($crop), "x", imagesy($crop), "\n";
