C# 控制台应用程序 System.Drawing 背景透明度问题
应该是一个快速而简单的问题。
默认情况下,System.Drawing.Graphics.DrawImage() 或 Image.Save() 是否使图像背景透明?我必须使用 System.Drawing.Bitmap 来调整图像分辨率,现在所有转换后的图像都有透明背景。
更多细节:我们使用 ImageMagick 进行从 .eps 到 .jpg 的基本图像转换,但我们似乎无法确定 ImageMagick 中的分辨率转换,因此我们决定使用 System.Drawing 来处理该部分。我们还将 InterpolationMode 设置为 HighQualityBicubic。
如果您需要任何其他详细信息,请告诉我!
提前致谢!
- 杰西
Should be a quick and easy question.
Does System.Drawing.Graphics.DrawImage() or Image.Save() by default make an image background transparent? I had to use System.Drawing.Bitmap to adjust image resolutions and now all of the converted images have a transparent background.
Futher details: We are using ImageMagick to do the basic image conversion from .eps to .jpg, but we can't seem to nail down the resolution conversion in ImageMagick so we decided to use System.Drawing to handle that portion. We are also setting InterpolationMode to HighQualityBicubic.
Please let me know if you need any other details!
Thanks in advance!
- Jesse
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您创建一个新的(空)Format32bppArgb 位图,默认情况下它将完全透明。
DrawImage 和 Save 都与使其透明无关。但他们会尊重现有的透明度(如果像素格式支持透明度)。
如果您使用的是 ImageAttributes,您可能会犯一个错误(这可能会在使用例如 DrawImage 时创建透明度)。
If you create a new (empty) Format32bppArgb Bitmap it will, by default, be fully transparent.
Neither DrawImage nor Save have anything to do with making it transparent. But they will respect existing transparencies (if the Pixelformat supports transparencies).
If you are using ImageAttributes you might have made a mistake there (which could create transparency when using e.g. DrawImage).