$img = new imagick($image);
$img->setImageFormat($format);
if($format == 'jpg'){
$img->setImageCompression(Imagick::COMPRESSION_JPEG);
$img->setImageCompressionQuality(0);
//$img->enhanceImage();
}
$img->adaptiveResizeImage(1500, 0);
$img->writeImage($PNG_IMAGE);
This still makes for a really grainy image compared to the original .jpg-file
How do I resize the image properly with as little grain/distortion/blur as possible?
$img->setImageCompressionQuality(0)
sets the quality of the image. If you don't want to loose any quality set it to 100, but best for optimisation between 60-80.