设置格式
$rgb = new Imagick('/home/333.jpg'); $rgb->setImageResolution(300,300); $rgb->setCompression(Imagick::COMPRESSION_JPEG); $rgb->setImageCompressionQuality(100); $rgb->setCompressionQuality(100); $rgb->setImageFormat('jpg'); $rgb->stripImage();
判断图片色彩
$cs = $rgb->getImageColorspace(); if($cs == imagick::COLORSPACE_SRGB){ die('this is RGB'); }
转换图片色彩模式
$profiles = $rgb->getImageProfiles('*', false); $has_icc_profile = (array_search('icc', $profiles) !== false); if ($has_icc_profile === false) { $icc_rgb = file_get_contents(MIO_PATH.'Lib/ICC/rgb.icc'); $rgb->profileImage('icc', $icc_rgb); unset($icc_rgb); } $icc_cmyk = file_get_contents(MIO_PATH.'Lib/ICC/cmyk.icc'); $rgb->profileImage('icc', $icc_cmyk); unset($icc_rgb); $rgb->writeImage('/home/cmyk1.jpg');
图像缩放
$fg_img_obj->adaptiveResizeImage($fg_true_width,$fg_true_height);