[英]Why would the output image from this code be darker than the original?
I'm a newbie to working with images in NET. 我是使用NET中图像的新手。 My goal is to add text and an icon to the starting image, then save the output.
我的目标是在起始图像中添加文本和图标,然后保存输出。
The result comes out a bit darker. 结果变得更暗。 Starting with a solid image (png-24) #788eb3 comes out #6d84ab.
从纯色图像(png-24)开始,#788eb3出现#6d84ab。 Tested to insure background/transparency is not the issue.
经过测试以确保背景/透明性不是问题。
I removed everything except the code to get the image, then save it, and the result is still darker. 我删除了除代码以外的所有内容以获取图像,然后将其保存,结果仍然更暗。 What direction should I go to make this work better?
我应该朝哪个方向改善这项工作?
System.Drawing.Image img = Bitmap.FromFile(@"c:\\oldfile.png", true);
img.Save(@"c:\\newfile.png", ImageFormat.Png);
The real issue turned out to be the browser! 真正的问题竟然是浏览器! IE7 and IE8 render #788eb3 in a png differently than the same color as a css background color.
IE7和IE8在png中呈现的#788eb3与与CSS背景颜色相同的颜色不同。 IE9, Chrome and Firefox all look good.
IE9,Chrome和Firefox看起来都不错。
My guess is that you have the color correction turned on. 我的猜测是您已启用颜色校正。 Try passing false instead of true to Bitmap.FromFile.
尝试将false而不是true传递给Bitmap.FromFile。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.