How can the functionality and performance of thumbnail generation with ImageMagick be compared to other image processing libraries in PHP?

When comparing the functionality and performance of thumbnail generation with ImageMagick to other image processing libraries in PHP, it is important to consider factors such as ease of use, speed, and resource consumption. ImageMagick is a powerful library that offers extensive capabilities for image manipulation, including thumbnail generation. However, it may require more resources and be slower compared to other libraries such as GD or Imagick.

// Example code snippet using ImageMagick for thumbnail generation
$sourceImage = 'input.jpg';
$thumbnailImage = 'output_thumb.jpg';

$im = new Imagick($sourceImage);
$im->setImageFormat('jpeg');
$im->thumbnailImage(100, 100);
$im->writeImage($thumbnailImage);
$im->clear();
$im->destroy();