高品质保存图像 [英] save image with high quality
本文介绍了高品质保存图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨
i有一个图像,即时通讯使用LinearGradientBrush进行图像写入,但它将图像质量改为低质量,并且在保存图像时黯淡
我应该怎么做不改变保存质量?
我的保存代码
Hi
i have an image and i m using LinearGradientBrush for write on image but it change image quality to low quality and blear on save the image
what should i do it don't change quality on save?
my save code
bp = new Bitmap(pictureBox1.Image, width, height);
Graphics g = Graphics.FromImage(bp);
g.SmoothingMode = SmoothingMode.HighQuality;
g.InterpolationMode = InterpolationMode.HighQualityBilinear;
g.CompositingQuality = CompositingQuality.HighQuality;
g.PixelOffsetMode = PixelOffsetMode.HighQuality;
bp.Save(save.FileName);
这些是问题的图片
1-original image
原始图片 [ ^ ]
2 - 这是用LinearGradientBruh写的图像
使用LinearGradientBruh 写在图像上[ ^ ]
最好的问候
and these are pictures of problem
1-original image
Original Image[^]
2-and this is the image wrote on it with LinearGradientBruh
wrote on image with LinearGradientBruh [^]
Best Regards
推荐答案
你可能知道,jpeg正在使用有损压缩方法。因此,您可以指定压缩质量。仍然没有直截了当。请参阅此处: http://msdn.microsoft.com/en-us/ library / bb882583(v = vs.110).aspx [ ^ ]。我已经读过它默认为75%,但我没有找到任何可靠的参考资料。
As you probably know, jpeg is using a lossy compression method. Thus it is up to you to specify comression quality. Still it is not straighforward. See here: http://msdn.microsoft.com/en-us/library/bb882583(v=vs.110).aspx[^]. I have read that it is 75% by default, but I haven't found any reliable reference about.
如何:使用文本抗锯齿[ ^ ]。
当使用SmoothingMode枚举指定Graphics.SmoothingMode属性时,它不会影响文本。要设置文本呈现质量,请使用Graphics.TextRenderingHint属性和TextRenderingHint枚举。 [ ^ ]。
您的代码不会在图像上显示任何文字呈现。
是您的来源图片.jpg?或????
你用的是什么字体;是OpenType吗?
为什么要使用LinearGradientBrush来做文本?你的第二张照片显示没有任何渐变被应用于文字的证据。
你在油漆事件中做什么?
我认为您应该将源图像转换为.png图像,然后在其上绘制文本,并将其保存为.png:[ ^ ]。
"How to: Use Antialiasing with Text" [^].
"When the Graphics.SmoothingMode property is specified by using the SmoothingMode enumeration, it does not affect text. To set the text rendering quality, use the Graphics.TextRenderingHint property and the TextRenderingHint enumeration." [^].
Your code does not show any rendering of Text on the image.
Is your source picture a .jpg ? Or ????
What font are you using; is it OpenType ?
Why would you use a LinearGradientBrush to do Text ? Your second picture shows no evidence of any gradient being applied to the Text.
What are you doing in the Paint Event ?
I think you should take your source image turn it into a .png image, then draw the Text on it, and save it as .png: [^].
这篇关于高品质保存图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文