方法有很多,这只是其中一种#include <GDIPlus.au3>
Local $pic = @HomeDrive & "\Source.bmp"
_ImageCut($pic, 300, 230, 50, 30, $pic & '_1.bmp')
Func _ImageCut($ImgFile, $ix, $iy, $iw, $ih, $ImgFileNew)
_GDIPlus_Startup()
Local $hImage = _GDIPlus_ImageLoadFromFile($ImgFile)
Local $hGraphics = _GDIPlus_ImageGetGraphicsContext($hImage)
Local $hBMPNew = _GDIPlus_BitmapCreateFromGraphics($iw, $ih, $hGraphics)
Local $hGraphicNew = _GDIPlus_ImageGetGraphicsContext($hBMPNew)
_GDIPlus_GraphicsDrawImageRectRect($hGraphicNew, $hImage, $ix, $iy, $iw, $ih, 0, 0, $iw, $ih)
_GDIPlus_GraphicsDispose($hGraphics)
_GDIPlus_GraphicsDispose($hGraphicNew)
_GDIPlus_ImageSaveToFile($hBMPNew, $ImgFileNew)
_GDIPlus_ImageDispose($hImage)
_GDIPlus_ImageDispose($hBMPNew)
_GDIPlus_Shutdown()
EndFunc ;==>_ImageCut
|