Some example code to test if concept still works used version 3.05.1 output.txt will contain the result (on my system about 30 seconds to analyze full screen which you probably normally should not do)
Tweaking with scaling somewhere above 4.0 scaling gives some nice results certainly on black/white areas.
However 8.0 is much to high.
#include <GUIConstantsEx.au3>
#include <ScreenCapture.au3>
local $TIF_FILENAME="c:\temp\test.tif"
Local $TESS_PARAMS= $TIF_FILENAME & " output"
Local $TESS_EXE=@ProgramFilesDir & "\Tesseract-OCR\tesseract.exe"
local $TWorkDir="C:\temp\"
Local $iScale = 8.0 ;1.0 is without any scaling
SaveTiffImage()
sleep(1000) ; Little time for saving the file
AnalyzeImage()
Func SaveTiffImage()
_GDIPlus_Startup()
Local Const $iW = @DesktopWidth , $iH = @DesktopHeight
Local $hHBmp = _ScreenCapture_Capture("", 0, 0, $iW, $iH) ;create a GDI bitmap by capturing 1/16 of desktop
Local $hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hHBmp) ;convert GDI bitmap to GDI+ bitmap
_WinAPI_DeleteObject($hHBmp) ;release GDI bitmap resource because not needed anymore
Local $hBitmap_Scaled = _GDIPlus_ImageScale($hBitmap, $iScale, $iScale, $GDIP_INTERPOLATIONMODE_NEARESTNEIGHBOR) ;scale image by 275% (magnify)
; Save resultant image
_GDIPlus_ImageSaveToFile($hBitmap_Scaled, $TIF_FILENAME)
;cleanup resources
_GDIPlus_BitmapDispose($hBitmap)
_GDIPlus_BitmapDispose($hBitmap_Scaled)
_GDIPlus_Shutdown()
EndFunc ;==>Example
func AnalyzeImage()
Local $hTimer = TimerInit() ; Begin the timer and store the handle in a variable.
shellexecutewait($TESS_EXE, $TESS_PARAMS, $TWorkDir)
Local $fDiff = TimerDiff($hTimer) ; Find the difference in time from the previous call of TimerInit. The variable we stored the TimerInit handlem is passed as the "handle" to TimerDiff.
consolewrite( ($fDiff/1000) & "seconds passed")
EndFunc