gpt4 book ai didi

c# - 为什么有些图像捕获比其他图像大 10 倍?

转载 作者:太空宇宙 更新时间:2023-11-03 11:02:29 25 4
gpt4 key购买 nike

当我截取 Windows 7 当前屏幕的屏幕截图时,生成的图像在 300kb 到 3.5MB 之间。是什么导致了相同屏幕尺寸和相同质量的尺寸变化?如何避免这种情况?

这是我使用的简单代码:

int screenWidth = Screen.GetBounds(new System.Drawing.Point(0, 0)).Width;
int screenHeight = Screen.GetBounds(new System.Drawing.Point(0, 0)).Height;

System.Drawing.Bitmap bmpScreenShot = new System.Drawing.Bitmap(screenWidth, screenHeight);
System.Drawing.Graphics gfx = System.Drawing.Graphics.FromImage((System.Drawing.Image)bmpScreenShot);

gfx.CopyFromScreen(0, 0, 0, 0, new System.Drawing.Size(screenWidth, screenHeight));

bmpScreenShot.Save(@"C:\\Snap.png", System.Drawing.Imaging.ImageFormat.Png);

最佳答案

如果没有更多关于两个屏幕截图之间差异的信息,我认为这是由于 PNG 文件的压缩策略所致:

http://en.wikipedia.org/wiki/Portable_Network_Graphics#File_size_and_optimization_software

也许您捕获的某些屏幕中的信息要少得多,并且可以更有效地压缩。

关于c# - 为什么有些图像捕获比其他图像大 10 倍?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17177474/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com