C# 的高效缩放
要放大和缩小图像,有一种可能的方法来调整图片框的大小并以拉伸模式显示图像。 虽然我不能有效地使用它,因为一般超过 8 倍它会给出存储错误 [认为图片框的大小(32k,32k)它需要超过 1GB 内存!
是否有特殊方法,或者我应该使用 ImageClone 仅缩放图像的可见部分?
更新:
这是项目,首先尝试缩放项目[不可能,存储错误],然后删除form.cs中的41行:
pictureBox1.Image = youPicture;
删除此行后,程序将运行,请移动缩放的图像。
这是链接: http://rapidshare.com/files/265835370/zoomMatrix.rar .html
To zoom images in and out, there is a possible way to resize the pictureBox and showing image in strechmode. Although I can not use it efficiently becauce in general over 8x it gives storage error [think that a pictureBox has the Size(32k, 32k) it needs over 1GB memory !
Is there a special method, or should I zoom only the seen part of the image by using ImageClone ?
Update:
Here is the project at first try to zoom at the project [impossible, storage error] than delete the 41. line in form.cs :
pictureBox1.Image = youPicture;
After deleting this line, the program will work, please move the zoomed image.
Here is the link: http://rapidshare.com/files/265835370/zoomMatrix.rar.html
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
通过使用矩阵对象和图形对象的变换属性:
By using the matrix object and the transform property of your graphics object:
我个人只会缩放可见部分,因为其余部分无论如何都是隐藏的(因此没有用)
I personally would just zoom the visible part as the rest is hidden anyway (and thus no use)
请参阅之前问题的此答案。 您绝对不想通过使图像变大并仅显示其一部分来进行缩放 - 您将遇到已经遇到的内存问题。 另外,图片框的拉伸模式不使用高质量插值,因此结果看起来非常糟糕。
在我在这里链接的答案中,我包含了一个 C# 项目的链接,该项目向您展示了如何进行这种缩放。
更新:这里是可下载项目的直接链接。
See this answer to an earlier question. You definitely don't want to zoom by making the image huge and showing only part of it - you'll run into the memory problem that you've already encountered. Also, the stretch mode of a picture box doesn't use high-quality interpolation, so the result will look pretty crappy.
In the answer I linked here, I included a link to a C# project that shows you how to do this kind of zooming.
Update: here is a direct link to the downloadable project.