Converting the outputted image format of an image created using Imagick (the PHP wrapper for ImageMagick) can be done using the setImageFormat function.

The example below will set the image format to png

$image = new Imagick("some/source/image.png");
$image->setImageFormat('png');
return $image;