#Include <FreeImage.au3>
Local $sFile = FileOpenDialog("Select image", @DesktopCommonDir, "All images (*.jpg;*.png;*.gif;*.bmp;)", 1)
If $sFile = "" Then Exit
_FreeImage_LoadDLL(@ScriptDir & '\FreeImage.dll')
_FreeImage_Initialise()
$FIF = _FreeImage_GetFileTypeU($sFile)
If $FIF = $FIF_UNKNOWN Then
$FIF = _FreeImage_GetFIFFromFilenameU($sFile)
EndIf
$hImage = _FreeImage_LoadU($FIF, $sFile)
$hGrey = _FreeImage_ConvertToGreyscale($hImage);8bit灰度色 这个正常
;~ $hGrey =_FreeImage_Threshold($hImage,127);二值化1bit 输出0字节文件?127该怎么表达?
;~ $hGrey =_FreeImage_Dither($hImage, FID_FS);抖动二值化 不能运行?
_FreeImage_SaveU($FIF, $hGrey, @ScriptDir & '\test.bmp')
_FreeImage_Unload($hImage)
_FreeImage_Unload($hGrey)
_FreeImage_DeInitialise()
|