PHP Imagick不会添加ICC颜色配置文件 [英] PHP Imagick won't add ICC color profile

查看:157
本文介绍了PHP Imagick不会添加ICC颜色配置文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做一个项目,我不得不稍微了解一下色彩配置文件,但仍然是一个新手.这段代码似乎没有添加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));

结果:

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

如果将参数icc更改为 any 其他字符串,它将出现在输出中,但文件大小不会改变(不确定是否会改变).

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'));

这在第二个print_r()输出中显示testWhatever.

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.

  • 版本:ImageMagick 7.0.7-11 Q16 i686 2017-11-12
  • PHP版本5.6.4
  • Tiff文件为CMYK

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

推荐答案

profileImage手册页上的注释使它得以解决:

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

http://php.net/manual/zh-CN/imagick.profileimage.php

解决方案:安装LCMS委托并重新编译ImageMagick,您可能还需要删除并重新安装PHP扩展.

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

如果profileImage()似乎什么都不做-并且在CMYK> RGB转换过程中出现反色"是这种现象的迹象-请检查ImageMagick是否具有可用的lcms委托.

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.

在命令提示符下:

convert -list configure | grep DELEGATES

如果您在列表中没有看到lcms,那么Imagick将不会做任何颜色 个人资料转换,不会对此发出任何警告.在那里面 情况下,安装Little CMS库( http://www.littlecms.com/),然后 重新编译ImageMagick.

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.

这篇关于PHP Imagick不会添加ICC颜色配置文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆