动态变色图像 [英] dynamic color change image

查看:75
本文介绍了动态变色图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我该如何动态更改图像(jpg,png和gif)的颜色.请帮助我的老板..

how can i change the image(jpg,png and gif) color in dynamically.plz help me boss..

推荐答案

如果您动态更改颜色,则在某些控件的表面或位图中更改它.但是对于位图(当然还有控件),没有JPG,PNG或GIF的概念-那些不是位图的位格式用于将位图保留在文件/流中.因此,严格来说,这个问题没有任何意义.

您所能做的就是动态创建/修改某些图像.如何执行取决于未标记的UI库.是WPF,System.Windows.Forms还是其他吗?在所有情况下,您都应该使用某种渲染方法来处理矢量或像素图形,并最终将其转换为屏幕或位图上的像素.无论如何,即使您有这种屏幕上渲染的方法,也可以将其抽象出来,以便在需要时在位图上渲染相同的图像.渲染位图后,可以保存它.仅在此刻,在JPG,PNG,GIF(还有更多)以及压缩参数和其他选项之间进行选择.

我没有提供更多细节,因为您没有指定UI库.我认为,到目前为止,总体思路已经足够.请问您下一个问题,正确标记所有相关信息.

—SA
If you change color dynamically, you change it on the surface of some control or in bitmap. But for a bitmap (and of course for a control), there is no a notion of JPG, PNG or GIF — those are not bitmaps bit the format used to persist a bitmap in the file/stream. By this reason, strictly speaking, the question makes no sense.

All you can do is to create/modify some image dynamically. How you do it, depends on the UI library, which you did not tag. Is it WPF, System.Windows.Forms, anything else? In all cases, you should have some rendering method working with vector or pixel graphics with will be ultimately translated into pixels on screen or the bitmap. Anyway, even if you have such method for on-screen rendering, you can abstract it out for rendering the same image on the bitmap, when it is required. After a bitmap is rendered, you can save it. Only at this moment the choice between JPG, PNG, GIF (one many more) as well as compression parameters and other options comes into play.

I did not provide more detail because you did not specify the UI library. For now the general idea is enough, I think. Please ask you next question properly tagging all the relevant information.

—SA


这篇关于动态变色图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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