2013-02-01 6 views
6

埋め込みカラープロファイルを持つJPEG画像が1つあります。一部のWebブラウザは、適用されたプロファイルでイメージを表示します。カラープロファイルをイメージに適用してプロファイルを削除する方法。すべてのブラウザで同じイメージが表示されること。画像にビルトインカラープロファイルを適用する

私はイメージ魔術拡張することで問題を解決しようとしたが、画像はまだ別のブラウザで異なる表示さ:

function add_color_profiles($source_path, $target_path){ 

      $all_exts = get_loaded_extensions(); 
      if(!in_array('imagick',$all_exts)) 
        return true; 

      $im1 = new Imagick($source_path); 
      $im2 = new Imagick($target_path); 

      $profiles = $im1->getImageProfiles(); 


      if(!$profiles) 
        return true; 

      foreach($profiles as $name => $profile){ 

        $im2->setImageProfile($name,$profile); 
      } 

      $im2->writeImage ($target_path); 

      return true; 
    } 

答えて

3

は(RGBに画像の色空間を変換する)画像にプロファイルを適用します。

$im->setImageColorspace(IMagick::COLORSPACE_RGB); 

ストリップ出力ファイルからのプロファイル情報:

$im->profileImage('*', NULL); 

すべてのプロファイルの画像を削除するes、exif(GPSデータなどのコメント):

$im->stripImage(); 
関連する問題