如何在运行时裁剪图像 [英] How Do I Crop An Image At Run Time
本文介绍了如何在运行时裁剪图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在图像上选择一些区域。然后我想将图像上的选择区域(矩形)移动到其他位置。当我完成选择后,我想点击裁剪按钮,我想得到其实际小尺寸的图像部分.....
请帮我解决我的问题...
谢谢
Hi,
I want to select some area on the image. then i want to move that selection area(rectangle) on the image to some other location. when i have done the selection then after that i want to click the crop button and i want to get that portion of image in its actual small size.....
please help me solving my problem...
thanks
推荐答案
很有可能,你需要这个: http://msdn.microsoft.com /en-us/library/system.drawing.bitmap.clone%28v=vs.110%29.aspx [ ^ ]。
使用这种方法很重要,不是说,Canvas.DrawImage
。
如果申请是WPF,这是一个不同的故事。请参阅: http:// msdn .microsoft.com / zh-CN / library / system.windows.media.imaging.croppedbitmap%28v = vs.110%29.aspx [ ^ ]。
另请参阅此CodeProject文章: WPF Interactive Image裁剪控制 [ ^ ]。
-SA
Most likely, you need this: http://msdn.microsoft.com/en-us/library/system.drawing.bitmap.clone%28v=vs.110%29.aspx[^].
It's important to use this method, not, say,Canvas.DrawImage
.
If you application is WPF, it's a different story. Please see: http://msdn.microsoft.com/en-us/library/system.windows.media.imaging.croppedbitmap%28v=vs.110%29.aspx[^].
See also this CodeProject article: WPF Interactive Image Cropping Control[^].
—SA
这篇关于如何在运行时裁剪图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文