C# 控制台应用程序 System.Drawing 背景透明度问题

发布于 2024-08-09 03:06:03 字数 379 浏览 3 评论 0原文

应该是一个快速而简单的问题。

默认情况下,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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

爱她像谁 2024-08-16 03:06:03

如果您创建一个新的(空)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).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文