加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

PHP想象将图像从CMYK转换为RGB反转图像

发布时间:2020-12-13 17:48:34 所属栏目:PHP教程 来源:网络整理
导读:我有一个图像被eBay API拒绝,因为: ShortMessageSource picture uses an unsupported colorspace./ShortMessage LongMessagePictures with a CMYK colorspace are not supported; source pictures must use a RGB colorspace compatible with all web brows
我有一个图像被eBay API拒绝,因为:

<ShortMessage>Source picture uses an unsupported colorspace.</ShortMessage>
    <LongMessage>Pictures with a CMYK colorspace are not supported; source pictures must use a RGB colorspace compatible with all web browsers supported by eBay. Submit pictures created using a camera or scanner set to save images with RGB color.</LongMessage>

好吧,我不知道这是一个CMYK,我甚至不知道怎么说.然后我使用以下代码尝试转换:

$image= "$img.jpg";
$i = new Imagick($image);
$i->setImageColorspace(Imagick::COLORSPACE_SRGB);
$i->writeImage($image);
$i->destroy();

它转换(现在被eBay接受),但它也会反转图片的颜色.为什么会这样做,是否还有我应该使用的另一个COLORSPACE?

谢谢.

解决方法

setImageColorSpace方法并不适用于现有图像 – 它仅适用于新图像(例如$imagick-> newPseudoImage(100,100,“xc:gray”);)

transformImageColorSpace方法是用于更改现有图像颜色空间的正确方法.

$image= "$img.jpg";
$i = new Imagick($image);
$i->transformImageColorspace(Imagick::COLORSPACE_SRGB);
$i->writeImage($image);
$i->destroy();

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读