
memerim
Active Members-
Posts
70 -
Joined
-
Last visited
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
memerim's Achievements

Wayfarer (2/7)
0
Reputation
-
Do you know how to convert a opencv image to a gdi hbitmap, and if them would takes lesss size on RAM or at the end would be the same thing as using by default a bitmap>hbitmap using just GDI? I'm storing some hbitmaps in memory but they are using too much RAM, i wonder ifs possible somehow do any kind of compression on them converting opencv > hbitmap?
-
How to create a pbitmap from graphics?
memerim replied to memerim's topic in AutoIt General Help and Support
_GDIPlus_BitmapCreateFromGraphics2 Its a different function? or did you mean FromGraphics? I mean from a hdc not a window. -
If i get a graphics from a call _GDIPlus_GraphicsCreateFromHDC How do i convert this graphics to a bitmap? What the function below return, isn't a bitmap? Func _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $hGraphics) Local $aResult = DllCall($__g_hGDIPDll, "int", "GdipCreateBitmapFromGraphics", "int", $iWidth, "int", $iHeight, "handle", $hGraphics, _ "handle*", 0) If @error Then Return SetError(@error, @extended, 0) If $aResult[0] Then Return SetError(10, $aResult[0], 0) Return $aResult[4] EndFunc ;==>_GDIPlus_BitmapCreateFromGraphics Theres an example in the docs: But the variable name is $g_hBitmap? hBitmap? Trying to understand how to use the function to get a bitmap from a graphics and save it to disk.
-
memerim reacted to a post in a topic: [Gdip] How to draw text on transparent bitmap?
-
[Gdip] How to draw text on transparent bitmap?
memerim replied to memerim's topic in AutoIt General Help and Support
-
[Gdip] How to draw text on transparent bitmap?
memerim replied to memerim's topic in AutoIt General Help and Support
Thank you UEZ, the image generated by the script have much more less quality when you compare with this one: -
[Gdip] How to draw text on transparent bitmap?
memerim replied to memerim's topic in AutoIt General Help and Support
#include <GDIPlus.au3> Text2PNG(@ScriptDir & "\x_2.png", 0x7DFFFFFF) ; Transparent text ShellExecute(@ScriptDir & "\x_2.png") Func Text2PNG($sFile, $iColor) _GDIPlus_Startup() Local $hImage = _GDIPlus_BitmapCreateFromScan0(400, 250) Local $hGraphics = _GDIPlus_ImageGetGraphicsContext($hImage) _GDIPlus_GraphicsClear($hGraphics, 0xFF7F7F7F) _GDIPlus_GraphicsSetSmoothingMode($hGraphics, $GDIP_SMOOTHINGMODE_HIGHQUALITY) _GDIPlus_GraphicsSetTextRenderingHint($hGraphics, $GDIP_TEXTRENDERINGHINT_ANTIALIAS) Local $hFormat = _GDIPlus_StringFormatCreate() Local $hFamily = _GDIPlus_FontFamilyCreate("Arial") Local $hFont = _GDIPlus_FontCreate($hFamily, 32) Local $hBrush = _GDIPlus_BrushCreateSolid($iColor) _GDIPlus_StringFormatSetAlign($hFormat, 1) _GDIPlus_StringFormatSetLineAlign($hFormat, 1) _GDIPlus_GraphicsDrawStringEx($hGraphics, "Hello World", $hFont, _GDIPlus_RectFCreate(0, 0, 400, 250), $hFormat, $hBrush) _GDIPlus_ImageSaveToFile($hImage, $sFile) _GDIPlus_FontDispose($hFont) _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_BrushDispose($hBrush) _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_BitmapDispose($hImage) _GDIPlus_Shutdown() EndFunc ;==>Text2PNG Now the image have no transparency: -
[Gdip] How to draw text on transparent bitmap?
memerim replied to memerim's topic in AutoIt General Help and Support
Hello @UEZ, the script resulted in a image without background, just the text, i would like to keep the background and just draw the text over it with the same level of transparency. The result im trying to achieve is something similar to this image: Its the same image of my first post, but now with the text drawn, and both have the same level of transparency. -
#include <GDIPlus.au3> Text2PNG(@ScriptDir & "\x_2.png", 0x7DFFFFFF) ; Transparent text Func Text2PNG($sFile, $iColor) _GDIPlus_Startup() Local $hImage = _GDIPlus_BitmapCreateFromFile ( $sFile ) ;Local $hImage = _GDIPlus_BitmapCreateFromScan0(400, 250) ;$sFile2 = @ScriptDir & "\x_3.png" ;_GDIPlus_ImageSaveToFile($hImage, $sFile2) Local $hGraphics = _GDIPlus_ImageGetGraphicsContext($hImage) _GDIPlus_GraphicsSetSmoothingMode($hGraphics, $GDIP_SMOOTHINGMODE_HIGHQUALITY) _GDIPlus_GraphicsSetTextRenderingHint($hGraphics, $GDIP_TEXTRENDERINGHINT_ANTIALIAS) _GDIPlus_GraphicsClear($hGraphics, $iColor) _GDIPlus_GraphicsDrawString($hGraphics, "Hello", 0, 0, "Arial", 32, 0) _GDIPlus_ImageSaveToFile($hImage, $sFile) _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_BitmapDispose($hImage) _GDIPlus_Shutdown() EndFunc ;==>Text2PNG The image is at 50% transparency, im trying to write the text on it with the same transparency. What transparency lvl the text will need to be drawn, to achieve the same transparency as on the image, 50% too? (0x7DFFFFFF) But atm it does not draw anything unless i create a new bitmap from scan, whats going on?
-
But its included Btw, i will re-do all steps again. I dont remember if i include it before or after running codescanner
- 432 replies
-
- encryption
- metacode
-
(and 3 more)
Tagged with:
-
Hi RTFC, im getting an error, hope you could guide me. All my scripts are in same folder, MCF0test.au3 is working perfect, exactly the original script. "When Codecrypter completes without errors, a new file MCF0test.au3 will have been created in the same directory as your original script. Make sure it performs exactly as your original version. If so, untick the original checkboxes in CodeCrypter and enable Encrypt instead. You may also wish to set specific Encryption options under the Tab. Finally, press " The error starts when i try encrypt MCF0test.au3. A doubt. If i encrypt my script and compile it to .exe, it still will work?
- 432 replies
-
- encryption
- metacode
-
(and 3 more)
Tagged with:
-
Thank you for the help Subz, you're always helping me out, thank you!!! 😸 Took 1.7 sec running your script to compare 5 img, its too much to me. I think doing this way: #RequireAdmin $t1 = TimerInit() $iC = @ScriptDir & "\compare" $X = 0 While 1 $X = $X + 1 $Commandline2 = "C:\Users\CAIO\Downloads\'&$X&'.bmp C:\Users\CAIO\Downloads\y.bmp -metric RMSE -subimage-search 2>diff.txt" RunWait(@ComSpec & " /C " & $iC & " " & $Commandline2, "", @SW_HIDE) $F = FileRead("C:\Users\CAIO\Downloads\ImageMagick\diff.txt") ConsoleWrite($X&" "&$F&@CRLF) If $X = 5 Then ExitLoop WEnd $t2 = TimerDiff($t1) ConsoleWrite("Time = "&$t2&@CRLF) ; Output: 1 1955.72 (0.0298424) 2 1955.72 (0.0298424) 3 1955.72 (0.0298424) 4 1955.72 (0.0298424) 5 1955.72 (0.0298424) Time = 545.9409 P.S: Any help increasing speed, are welcome! -EDIT- #RequireAdmin $t1 = TimerInit() $iC = "C:\Users\CAIO\Downloads\ImageMagick\compare.exe" $Commandline1 = "C:\Users\CAIO\Downloads\1.bmp C:\Users\CAIO\Downloads\y.bmp -metric RMSE -subimage-search 2>1.txt" $Commandline2 = "compare C:\Users\CAIO\Downloads\2.bmp C:\Users\CAIO\Downloads\y.bmp -metric RMSE -subimage-search 2>2.txt" $Commandline3 = "compare C:\Users\CAIO\Downloads\3.bmp C:\Users\CAIO\Downloads\y.bmp -metric RMSE -subimage-search 2>3.txt" $Commandline4 = "compare C:\Users\CAIO\Downloads\4.bmp C:\Users\CAIO\Downloads\y.bmp -metric RMSE -subimage-search 2>4.txt" $Commandline5 = "compare C:\Users\CAIO\Downloads\5.bmp C:\Users\CAIO\Downloads\y.bmp -metric RMSE -subimage-search 2>5.txt" RunWait(@ComSpec & " /C " & $iC & " " & $Commandline1 & " & " & $Commandline2 & " & " & $Commandline3 & " & " & $Commandline4 & " & " & $Commandline5, "", @SW_HIDE) $Y = 0 While 1 $Y = $Y + 1 $F = FileRead("C:\Users\CAIO\Downloads\ImageMagick\"&$Y&".txt") ConsoleWrite($Y&" "&$F&@CRLF) If $Y = 5 Then ExitLoop WEnd $t2 = TimerDiff($t1) ConsoleWrite("Time = "&$t2&@CRLF) ; I decreased the time to 190ms! I put all the commands inside variables $Commandline1 saving output to different files, then read it values.
-
-
Supposed to send the commands inside the command line window?
-
The boxs are poppin blank and even changing msgbox to consolewrite the diff time changed from 500ms to 1793 . I have tried store the value to a ini, but even on ini it stored nothing: $out = StdoutRead($pid) StdioClose($pid) IniWrite("C:\Users\CAIO\Downloads\TEST.ini", "Value", $X, $out) Ini: 😡
-
#RequireAdmin #include <WinAPIProc.au3> #include <AutoItConstants.au3> Opt("ExpandVarStrings", 1) $t1 = TimerInit() $iC = @ScriptDir & "\compare" $X = 0 While 1 $X = $X + 1 $Commandline2 = "C:\Users\CAIO\Downloads\'&$X&'.bmp C:\Users\CAIO\Downloads\y.bmp -metric RMSE -subimage-search" $pid = RunWait(@ComSpec & " /C " & $iC & " " & $Commandline2, "", @SW_HIDE, $STDOUT_CHILD) ;ProcessWaitClose($pid) $out = StdoutRead($pid) StdioClose($pid) $Y = StringLeft($out, StringInStr($out, " (", 0, 1) - 1) ConsoleWrite($X&" = "&$Y&@CRLF); test If $X = 5 Then ExitLoop WEnd $t2 = TimerDiff($t1) ConsoleWrite("Time = "&$t2&@CRLF) My output continues messed up: 1955.72 (0.0298424)1 = 1955.72 (0.0298424)2 = 3 = 1955.72 (0.0298424)4 = 1955.72 (0.0298424)5 = Time = 554.1816 1955.72 (0.0298424)+>13:47:08 AutoIt3.exe ended.rc:0 Time = 554.1816 1955.72 (0.0298424) The code wrote things of $Y after $Time whos on the end 😵 I have run $Y = StringInStr($out, "(", 0, 1, 1) ConsoleWrite("Y = "&$Y&@CRLF) And its returning 0