function tiff2jpg($file,$newname) {
$mgck_wnd = NewMagickWand();
MagickReadImage($mgck_wnd, $file);
$img_colspc = MagickGetImageColorspace($mgck_wnd);
//if ($img_colspc == MW_CMYKColorspace) {
// echo "$file was in CMYK format<br />";
// MagickSetImageColorspace($mgck_wnd, MW_RGBColorspace);
//MagickWand这个扩展默认不支持tiff格式的图片
// }
MagickSetImageFormat($mgck_wnd, 'JPG' );
MagickWriteImage($mgck_wnd, $newname);
}
这儿有一个要注意的地方,MagickWand这个扩展默认不支持tiff格式的图片,要装一下。
转变图像模式会有问题,转成的jpg图片颜色改了。