处理GD库时不必要地改变颜色 [英] When dealing with GD Library unwantedly altering colors

查看:104
本文介绍了处理GD库时不必要地改变颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将多个小图片合并为矩形马赛克。

I'm merging multiple small images into a rectangular mosaic.

当处理少量源图像时,结果很好:

When dealing with a small number of source images it turns out fine:

但是当处理大量来源时,它会产生类似于棕褐色的效果:

But when dealing with a larger number of sources it turns out a sepia like effect:

我是否应该使用任何技术来保留颜色?

Is there any technique I should be used to preserve the colors?

我合并图像的方法本质上是运行一个脚本,使用 imagecreatefromjpeg()来遍历源图像以获取它,然后是 imagecopy()将源合并到集合目标图像上(并运行直到添加/放置所有图像)。

My method for merging the images is essentially running a script that loops through the source images using imagecreatefromjpeg() to grab it, followed by imagecopy() to merge the source onto the collective destination image (and runs until all images have been added/placed).

推荐答案

而不是使用imagecreate()作为我的起点,我改为imagecreatetruecolor()a它已经解决了颜色损失问题。

instead of using imagecreate() as my starting point, I changed to imagecreatetruecolor() and it has resolve the color loss issue.

这篇关于处理GD库时不必要地改变颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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