jQuery:有一种方法可以将颜色(色调)应用于图像吗?
有没有办法使用 jQ 或一些插件来为图像着色(应用色调)? 谢谢
there is a way to colour (apply tint) an image using jQ or some plugs?
thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我能想到的最简单的方法是在图像上覆盖一个半透明的 div。
一个小例子:
HTML
CSS
JS(使用 JQuery)
Simplest way I can think of is overlaying a semitransparent div over the image.
A little example:
HTML
CSS
JS (with JQuery)
正如动态改变图像颜色中已经提到的
,看看Pixastic (颜色调整)
https://github.com/jseidelin/pixastic
http://www.pixastic.com/lib/docs/actions/coloradjust/
或PaintbrushJS(色调)
https://github.com/mezzoblue/PaintbrushJS
http://mezzoblue.github.com/PaintbrushJS/demo/
As already mentioned in Dynamically changing image colours
take a look at Pixastic (coloradjust)
https://github.com/jseidelin/pixastic
http://www.pixastic.com/lib/docs/actions/coloradjust/
or PaintbrushJS (colour tint)
https://github.com/mezzoblue/PaintbrushJS
http://mezzoblue.github.com/PaintbrushJS/demo/
如果您想要一种简单的颜色,nico 的答案很好 - 但是,如果您正在谈论降低图像的饱和度,然后然后应用色调(例如,图像仅呈绿色) )然后您可以使用
来查看图像处理
经过一番谷歌搜索后,我发现了这个专注于照片处理操作的画布库: com/meltingice/CamanJS" rel="nofollow">https://github.com/meltingice/CamanJS
nico's answer is great if you're after a simple tinge of a colour - however, if you're talking about desaturating an image and then applying a tint (so that the image is only in green for example) then you can have a look at image manipulation with
<canvas>
After some googling, I found this library for canvas that focuses on photo manipulation operations: https://github.com/meltingice/CamanJS
我不确定你是否使用 PHP,但使用 JavaScript/jQuery 是不可能的。通过 PHP,您可以在将图像发送到客户端之前使用 GD 图像库对图像进行着色。 此线程应该有所帮助:-)
另外,< a href="http://www.sitepoint.com/forums/showthread.php?t=600376" rel="nofollow noreferrer">此论坛帖子也讨论了 ImageMagick 对图像进行着色。
如果您不会/不能使用 PHP,我很抱歉,但是 JavaScript 无法完成您想要的操作。
詹姆斯
I'm not sure if you're using PHP, but it's not possible with JavaScript/jQuery. With PHP, you can use the GD image library to tint the image before it's sent to the client. This thread should help :-)
Also, this forum thread talks about ImageMagick to tint the image as well.
I'm very sorry if you aren't/can't use PHP, however JavaScript can't do what you want.
James