回复 11# peter13447
如果是jpg,需要设置质量
Local $pic_old = 'j.JPG', $pic_new = 'jj.JPG'
_GDIPlus_Startup()
Local $hImage = _GDIPlus_BitmapCreateFromFile($pic_old)
Local $hClone = _GDIPlus_BitmapCloneArea($hImage, 100, 100, 60, 100, $GDIP_PXF24RGB)
Local $giQuality = 100, $pParams
Local $tParams = _GDIPlus_ParamInit(1)
Local $tData = DllStructCreate('int Quality')
DllStructSetData($tData, 'Quality', $giQuality)
_GDIPlus_ParamAdd($tParams, $GDIP_EPGQUALITY, 1, $GDIP_EPTLONG, DllStructGetPtr($tData))
If IsDllStruct($tParams) Then $pParams = DllStructGetPtr($tParams)
Local $CLSID = _GDIPlus_EncodersGetCLSID('JPG')
_GDIPlus_ImageSaveToFileEx($hClone, $pic_new, $CLSID, $pParams)
_GDIPlus_ImageDispose($hClone)
_GDIPlus_ImageDispose($hImage)
_GDIPlus_Shutdown()
|