Imagick php class not working when I try to set image resolution and color space for a base64 image then saving it in jpg format

Viewed 96

I'm trying to generate a high resolution jpg image from base24 image string using imagick php class. the code runs with no errors. However, the image saved does not show any resolution or color space in photo viewers or browsers. I don't know whether my code is working or not?! Any help on this is highly appreciated.

$image_data = base64_decode($data);
$imagick = new Imagick();
$imagick->readImageBlob($image_data);
$jpegimagequality = 95;
$imagick->setImageCompression(Imagick::COMPRESSION_JPEG);
$imagick->setImageCompressionQuality($jpegimagequality);
$imagick->setImageResolution(300,300);
$imagick->setImageColorspace(Imagick::COLORSPACE_SRGB);
$imageResampled = $imagick->resampleImage(300, 300, Imagick::FILTER_UNDEFINED, 1);
$imagick->setImageFormat("jpg");
$devimageSaved = $imagick->writeImage('jpg:'.$hiResPosterImagePathDev);
0 Answers
Related