doumeng1143 2017-11-21 13:35
浏览 94
已采纳

PHP Imagick不会添加ICC颜色配置文件

I'm working on a project where I've had to learn about color profiles a bit, still very much a novice. This code doesn't seem to be adding the icc profile:

$im = new Imagick;
$im->readImage('input.tif');

print_r($im->getImageProfiles('*', false));

$im->stripImage();
$im->profileImage('icc', file_get_contents('myprofile.icc'));

print_r($im->getImageProfiles('*', false));

Result:

Array
(
    [0] => 8bim
    [1] => icc
    [2] => xmp
)
Array
(
)

If I change the argument icc to any other string it appears in the output, but the file size doesn't change (not certain if it would).

$im->profileImage('testWhatever', file_get_contents('myprofile.icc'));

This shows testWhatever in the second print_r() output.

What could be the issue and how can I debug this? I've read nearly every post here about this topic, I'm happy to provide more information.

Debug notes, hopefully something here is useful:

  • Version: ImageMagick 7.0.7-11 Q16 i686 2017-11-12
  • PHP version 5.6.4
  • Tiff file is CMYK

Output of convert -list configure

Path: /usr/local/lib/ImageMagick-7.0.7//config-Q16HDRI/configure.xml

Name           Value
-------------------------------------------------------------------------------
CC             gcc -std=gnu99 -std=gnu99
CFLAGS         -I/usr/include/libxml2   -I/usr/include/libpng12    -pthread -I/usr/include/pango-1.0 -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12   -I/usr/include/freetype2        -fopenmp -g -O2 -Wall -mtune=core2 -fexceptions -pthread -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16
CODER_PATH     /usr/local/lib/ImageMagick-7.0.7/modules-Q16HDRI/coders
CONFIGURE      ./configure
CONFIGURE_PATH /usr/local/etc/ImageMagick-7/
COPYRIGHT      Copyright (C) 1999-2017 ImageMagick Studio LLC
CPPFLAGS       -I/usr/local/include/ImageMagick-7
CXX            g++
CXXFLAGS       -g -O2 -pthread
DEFS           -DHAVE_CONFIG_H
DELEGATES      bzlib mpeg fontconfig freetype jng jpeg pango png ps tiff x xml zlib
DISTCHECK_CONFIG_FLAGS  --disable-deprecated  --with-quantum-depth=16  --with-jemalloc=no  --with-umem=no  --with-autotrace=no  --with-gslib=no  --with-fontpath=  --with-rsvg=no  --with-perl=no
DOCUMENTATION_PATH /usr/local/share/doc/ImageMagick-7
EXEC-PREFIX    /usr/local
EXECUTABLE_PATH /usr/local/bin
FEATURES       DPC HDRI Cipher OpenMP
FILTER_PATH    /usr/local/lib/ImageMagick-7.0.7/modules-Q16HDRI/filters
GIT_REVISION   12832
HOST           i686-pc-linux-gnu
INCLUDE_PATH   /usr/local/include/ImageMagick-7
LDFLAGS        -L/usr/local/lib
LIB_VERSION    0x707
LIB_VERSION_NUMBER 7,0,7,11
LIBRARY_PATH   /usr/local/lib/ImageMagick-7.0.7
LIBS              -ltiff -lfreetype    -ljpeg   -lpng12        -lfontconfig      -lXext -lXt   -lSM -lICE -lX11   -lbz2   -pthread -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lrt -lglib-2.0     -lxml2    -lz    -lm -lgomp
NAME           ImageMagick
PCFLAGS        -fopenmp -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16
PREFIX         /usr/local
QuantumDepth   16
RELEASE_DATE   2017-11-21
SHARE_PATH     /usr/local/share/ImageMagick-7
SHAREARCH_PATH /usr/local/lib/ImageMagick-7.0.7/config-Q16HDRI
TARGET_CPU     i686
TARGET_OS      linux-gnu
TARGET_VENDOR  pc
VERSION        7.0.7
WEBSITE        http://www.imagemagick.org

Path: [built-in]

Name           Value
-------------------------------------------------------------------------------
FEATURES       OpenMP
NAME           ImageMagick
QuantumDepth   16
  • 写回答

1条回答 默认 最新

  • dtd14883 2017-11-25 01:51
    关注

    Figured it out thanks to a comment on the profileImage manual page:

    http://php.net/manual/en/imagick.profileimage.php

    Solution: Install LCMS delegates and recompile ImageMagick, you may need to remove and reinstall the PHP extension as well.

    If profileImage() seems to be doing nothing — and "inverted colors" during a CMYK > RGB conversion is a sign of this — check that ImageMagick has the lcms delegate available.

    From a command prompt:

    convert -list configure | grep DELEGATES

    If you don't see lcms in the list then Imagick won't do any color profile conversions, and won't give any warnings about this. In that case, install the Little CMS library ( http://www.littlecms.com/ ) and recompile ImageMagick.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?