如何更改复合svg对象的颜色 [英] How to change the color of a composite svg oject

查看:94
本文介绍了如何更改复合svg对象的颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有阴影和高光的复合svg对象.有没有一种方法可以更改对象的颜色,而不必指定对阴影和阴影的更改.突出显示吗?

I have a composite svg object with shading and highlights. Is there a way to change the objects color without having to specify changes to the shading & highlighting as well?

我尝试使用灰度底图svg和顶部的svg,在其中可以更改填充和不透明度,但是生成的颜色看起来很平坦.

I have tried using a greyscale underlying svg and an svg on top where I can change the fill and opacity, but the resulting colors look flat.

这里有图书馆吗?

推荐答案

我创建了一种算法来遍历灰度svg的路径,该路径按阴影(ta,Inkscape)排序,并更改阴影以创建我的彩色图像.

I created an algorithm to loop through the paths of a grey-scale svg where the paths are ordered by shade (ta, Inkscape) and changed the shade to create my colored image.

请参见为阴影着色 rgbToHex 以获得有用的信息.

See tinting a shade and rgbToHex here for useful info.

效果很好.但是现在我发现,要获得一个漂亮"的图像,我有150kb的svg文件(60个阴影路径,每个路径大约10kb,其中2个路径成本36kb).不太好,尤其是原始的png仅为21kb.但是在谷歌搜索之后,看起来移动应用程序大小最大为2GB是可以的.这意味着我的,即使有很大的png文件,也可能将比例缩放到10mb左右.

That worked well. But now I find that to get a "nice" image I have svg files of 150kb (60 paths for shading, roughly 10kb per path with 2 paths costing 36kb). Not so good, especially as the original png was only 21kb. But after googling, it seems mobile app sizes of up to 2gb are ok. Which means mine, probably tipping the scales at around 10mb even with big png files, should be fine.

这篇关于如何更改复合svg对象的颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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