2013-08-02 38 views
0

我使用PHP的Imagick擴展來處理圖像。以下是我的代碼Imagick在使用imagick時出現負像的結果:: profileImage

try{ 
    $sourceimg=dirname(__FILE__)."\\source.jpg"; 
    $destinationimg=dirname(__FILE__)."\\source_cmyk.tiff"; 
    $im=new Imagick(); 
    $im->setResolution(300,300); 
    $im->readImage($sourceimg); 
    $im->setImageColorSpace(imagick::COLORSPACE_CMYK); 
    $im->stripImage(); 
    [email protected]_get_contents("C:\\USWebUncoated.icc"); 
    $im->profileImage("icm",$cmykprofile); 
    $im->setImageDepth(8); 
    $im->setImageUnits(1); //0=undefined, 1=pixelsperInch, 2=PixelsPerCentimeter 
    $im->setResolution(300,300); //set output resolution to 300 dpi 
    $im->setImageCompressionQuality(100); 
    $im->writeImage($destinationimg); 

}catch(ImagickException $e){ 
    echo $e->getMessage(); 
} 

我遇到的問題是代碼否定原始圖像。只有當我使用$im->profileImage時,纔會出現此問題。這將是什麼原因?以及如何解決這個問題?我使用的配置文件是我從http://www.adobe.com/support/downloads/detail.jsp?ftpID=3680

下載的cmyk顏色配置文件任何幫助將不勝感激。

感謝

回答

0

如果您使用的是與專業的色彩配置文件或非RGB圖像(例如CMYK JPEG)的圖像,你應該首先將它們轉換爲sRGB。

帶條紋配置文件ICC顏色配置文件也是如此。大多數瀏覽器使用gamma 2.2(默認值)顯示剝離的圖像,這與CMYK不同。

解決您的問題的方法是在這裏的用戶貢獻備註:http://www.php.net/manual/en/imagick.setimagecolorspace.php