本文介绍了获取图像的特定部分(图)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我要剪切的图像的特定部分,并用它来裁剪后的图像与另一存储在HDD比较。问题是,我不知道如何让源图像的特定部分。我知道位置(X,Y)的图像进行裁剪。
I want to cut the the specific portion of the the picture and use it to compare the cropped image with another stored in the HDD. The problem is that I don't know how to get a specific section of the source image. I know the location (X,Y) of the image to be cropped.
推荐答案
这将加载原始,并创建一个播种的版本开始在(0,0)和64×64的尺寸。
This will load the original and create a cropped version starting at (0,0) and with dimensions of 64x64.
Bitmap original = new Bitmap( @"C:\SomePath" );
Rectangle srcRect = new Rectangle( 0, 0, 64, 64 );
Bitmap cropped = (Bitmap)original.Clone( srcRect, original.PixelFormat );
顺便说一句,你不指定,如果这是的WinForms或WPF,与WinForms的那么回事,因为我真的不知道WPF图像处理功能。
BTW, you don't specify if this is WinForms or WPF, so going with WinForms as I don't really know WPF image manipulation functions.
这篇关于获取图像的特定部分(图)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!