Jump to content

Recommended Posts

Posted (edited)

Hello everybody..

 

i have this picture here *attached* and this script here: GDIPlus_Image2.jpg

 

$ImageToReadPath = @MyDocumentsDir & "\GDIPlus_Image2.jpg"
$ResultTextPath = @MyDocumentsDir & "\Result"
$OutPutPath = $ResultTextPath & ".txt"
$TesseractExePath = @MyDocumentsDir & "\Tesseract.exe"

ShellExecuteWait($TesseractExePath, '"' & $ImageToReadPath & '" "' & $ResultTextPath & '"', "", "", @SW_HIDE)


If @error Then
    Exit MsgBox(0, "Error", @error)
EndIf

MsgBox(0, "Result", FileRead($OutPutPath))

FileDelete($OutPutPath)

 

but tesseract doesnt recognized the correct word... and gives me trash back...

this is the image >> GDIPlus_Image2.jpg

and the result was >> "samm:lmao:

the image was an normal jpg and generated with this code here:
 

_ScreenCapture_Capture(@MyDocumentsDir & "\GDIPlus_Image2.jpg", 712,268,853,284)


Could anybody give me a hint what i can do better to get this easy image to text?

 

thank u very much!!!

 

 

Edit: i also tried to capture the screen as bmp with a higher resolution... nothing changed... 

 

 

_ScreenCapture_SetBMPFormat(4)
    _ScreenCapture_Capture(@MyDocumentsDir & "\GDIPlus_Image.bmp", 712,279,853,295)

 

Edited by nbg15
Posted

You can open the image in Paint, double the width and height, save the image and try again.

It's a small image, and there is a risk that there simply are too few pixels to recognize the characters. It usually helps to make the image larger.

Posted

Hi nbg15,

You should be able to resize your image with this script:

#include <GDIPlus.au3>

; init
_GDIPlus_Startup()

; get file
$sFile = FileOpenDialog("Select an image (non JPG)", "", "Images (*.bmp;*.png;*.gif;*.tif)")
$hImage = _GDIPlus_ImageLoadFromFile($sFile)

; size
$width = _GDIPlus_ImageGetWidth($hImage)
$height = _GDIPlus_ImageGetHeight($hImage)

; resize image 200%
$hBitmap_Scaled = _GDIPlus_ImageResize($hImage, $width * 2, $height * 2)
; save file
_GDIPlus_ImageSaveToFile($hBitmap_Scaled, @ScriptDir & "\resized.png")

; clean up
_GDIPlus_ImageDispose($hImage)
_GDIPlus_BitmapDispose($hBitmap_Scaled)

; done
_GDIPlus_Shutdown()

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...