Jump to content

rapot

Members
  • Posts

    12
  • Joined

  • Last visited

Everything posted by rapot

  1. still save as different file. I want save : _GDIPlus_ImageSaveToFile($hBitmap, $sFile) overwrite not work?
  2. I want to load an image file, edit..., then... save it. Load image : #include <gdip.au3> #include <GDIPlus.au3> $image = _GDIPlus_ImageLoadFromFile(@MyDocumentsDir & "\GDIPlus_Image.jpg") Edit : put pixel _GDIPlus_BitmapSetPixel($image, 15, 10, 0xffff00ff) Save : _GDIPlus_ImageSaveToFile($image, @MyDocumentsDir & "\GDIPlus_Image.jpg") so it don't work. Please help me.
  3. Hi, some one please help me about Image Edge Detection in Autoit. Thanks.
  4. I can't do i still wait for help forever
  5. I was looking around forum but AutoIt but do not found any topic to write about Convolution two array. I just found this>>Convolution.Au3 It Convolution with image.So i find function Convolution two array with assembly in autoit Anyone can write a function Convolution like this: http://www.ece.umd.edu/~tretter/commlab/c6713slides/convol1.sa Please share me Thanks Convolution.au3 Fasm.rar
  6. I think AutoIt must be compatible with other languages to ease development. I tried embedding the library other languages into AutoIt
  7. How i can send message between 2 computer by: autoIT client: $c_Ip = "127.0.0.1" $c_Port = 6879 TCPStartup() $socket = TCPConnect($c_Ip, $c_Port) if $socket = -1 Then msgbox(0, "Error", "Error Connecting") EndIf while True $msg = inputbox("Send msg", "Send msg to server") TCPSend($socket, $msg) sleep(1) WEnd Java server: import java.net.*; import javax.swing.*; import java.io.*; import java.util.*; import java.awt.*; import java.io.BufferedReader; public class Server { public Server() { } public static void main(String[] args) { final int port = 6879; Socket clientsocket = null; ServerSocket sSocket = null; BufferedReader in = null; InputStream ins = null; BufferedReader inStream = null; String msg = ""; try{ sSocket = new ServerSocket(port); }catch(IOException e){ System.out.println("Error: " + e); } System.out.println("Starting server.."); try{ clientsocket = sSocket.accept(); }catch(IOException e){ System.out.println("Error: " + e); } System.out.println("Connection detected!"); try{ ins = clientsocket.getInputStream(); InputStreamReader blah = new InputStreamReader(ins); inStream = new BufferedReader(blah); }catch(IOException aE){ System.out.println("Error: " + aE ); } while(true){ try{ msg = inStream.readLine(); if(msg != ""){ System.out.println(msg); msg = ""; } ins = clientsocket.getInputStream(); System.out.println("e" + msg); }catch(IOException aE){ System.out.println("Error: " + aE); System.exit(0); } } } }
  8. Thank for your help I think it has solved the main problem. I have been doing so already. I known programs run slower when using _GDIPlus_BitmapGetPixel function too many. I thought about the create $aImage[$y][$x] at the same time with the transfer to grayscale but i can't do it PixelRGB[$i][$j] -> PixelGray[$i][$j] aImage[$i][$j]=PixelGray[$i][$j] I want a solution as above Please help me. GDIP.rar
  9. Hi BufferedImage in there program is $hImage2 #include <GDIP.au3> _GDIPlus_Startup() $FileName = FileOpenDialog("Select an image", @ScriptDir & "\", "Images (*.jpg;*.bmp;*.png;*.gif)", 1) $hImage1 = _GDIPlus_ImageLoadFromFile($FileName) $hImage2 = _GDIPlus_ImageGreyscale($hImage1) $Width = _GDIPlus_ImageGetWidth($hImage2) $Height = _GDIPlus_ImageGetHeight($hImage2) $hGUI = GUICreate("Convert image to greyscale", $Width, $Height) GUISetState() $hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGUI) _GDIPlus_GraphicsDrawImageRect($hGraphic, $hImage2, 0, 0, $Width, $Height) _GDIPlus_ImageDispose ($hImage1) _GDIPlus_ImageDispose ($hImage2) _GDIPlus_ShutDown () While GUIGetMsg() <> -3 * Sleep(50) WEnd I want create an array like $aImage[$Height][$Width] from $hImage2 Someone please help me
  10. How can I use a BufferedImage as an array of byte? Local $aImage[$Height][$Width] Please help me Thank
  11. Can you please let me know how to covert a BufferedImage to a byte array???
  12. #include-once ; ------------------------------------------------------------------------------ ; ; AutoIt Version: 3.0 ; Language: English ; Description: Functions that assist with Image Search ; Require that the ImageSearchDLL.dll be loadable ; ; ------------------------------------------------------------------------------ ;=============================================================================== ; ; Description: Find the position of an image on the desktop ; Syntax: _ImageSearchArea, _ImageSearch ; Parameter(s): ; $findImage - the image to locate on the desktop ; $tolerance - 0 for no tolerance (0-255). Needed when colors of ; image differ from desktop. e.g GIF ; $resultPosition - Set where the returned x,y location of the image is. ; 1 for centre of image, 0 for top left of image ; $x $y - Return the x and y location of the image ; $transparency - TRANSBLACK, TRANSWHITE or hex value (e.g. 0xffffff) of ; the color to be used as transparency; can be omitted if ; not needed ; ; Return Value(s): On Success - Returns 1 ; On Failure - Returns 0 ; ; Note: Use _ImageSearch to search the entire desktop, _ImageSearchArea to specify ; a desktop region to search ; ;=============================================================================== Func _ImageSearch($findImage,$resultPosition,ByRef $x, ByRef $y,$tolerance,$transparency=0) return _ImageSearchArea($findImage,$resultPosition,0,0,@DesktopWidth,@DesktopHeight,$x,$y,$tolerance,$transparency) EndFunc Func _ImageSearchArea($findImage,$resultPosition,$x1,$y1,$right,$bottom,ByRef $x, ByRef $y, $tolerance, $transparency=0) ;MsgBox(0,"asd","" & $x1 & " " & $y1 & " " & $right & " " & $bottom) if not ($transparency = 0) then $findImage = "*" & $transparency & " " & $findImage if $tolerance>0 then $findImage = "*" & $tolerance & " " & $findImage $result = DllCall("ImageSearchDLL.dll","str","ImageSearch","int",$x1,"int",$y1,"int",$right,"int",$bottom,"str",$findImage) ; If error exit if $result[0]="0" then return 0 ; Otherwise get the x,y location of the match and the size of the image to ; compute the centre of search $array = StringSplit($result[0],"|") $x=Int(Number($array[2])) $y=Int(Number($array[3])) if $resultPosition=1 then $x=$x + Int(Number($array[4])/2) $y=$y + Int(Number($array[5])/2) endif return 1 EndFunc ;=============================================================================== ; ; Description: Wait for a specified number of seconds for an image to appear ; ; Syntax: _WaitForImageSearch, _WaitForImagesSearch ; Parameter(s): ; $waitSecs - seconds to try and find the image ; $findImage - the image to locate on the desktop ; $tolerance - 0 for no tolerance (0-255). Needed when colors of ; image differ from desktop. e.g GIF ; $resultPosition - Set where the returned x,y location of the image is. ; 1 for centre of image, 0 for top left of image ; $x $y - Return the x and y location of the image ; $transparency - TRANSBLACK, TRANSWHITE or hex value (e.g. 0xffffff) of ; the color to be used as transparency can be omitted if ; not needed ; ; Return Value(s): On Success - Returns 1 ; On Failure - Returns 0 ; ; ;=============================================================================== Func _WaitForImageSearch($findImage,$waitSecs,$resultPosition,ByRef $x, ByRef $y,$tolerance,$transparency=0) $waitSecs = $waitSecs * 1000 $startTime=TimerInit() While TimerDiff($startTime) < $waitSecs sleep(100) $result=_ImageSearch($findImage,$resultPosition,$x, $y,$tolerance,$transparency) if $result > 0 Then return 1 EndIf WEnd return 0 EndFunc ;=============================================================================== ; ; Description: Wait for a specified number of seconds for any of a set of ; images to appear ; ; Syntax: _WaitForImagesSearch ; Parameter(s): ; $waitSecs - seconds to try and find the image ; $findImage - the ARRAY of images to locate on the desktop ; - ARRAY[0] is set to the number of images to loop through ; ARRAY[1] is the first image ; $tolerance - 0 for no tolerance (0-255). Needed when colors of ; image differ from desktop. e.g GIF ; $resultPosition - Set where the returned x,y location of the image is. ; 1 for centre of image, 0 for top left of image ; $x $y - Return the x and y location of the image ; $transparent - TRANSBLACK, TRANSWHITE or hex value (e.g. 0xffffff) of ; the color to be used as transparent; can be omitted if ; not needed ; ; Return Value(s): On Success - Returns the index of the successful find ; On Failure - Returns 0 ; ; ;=============================================================================== Func _WaitForImagesSearch($findImage,$waitSecs,$resultPosition,ByRef $x, ByRef $y,$tolerance,$transparency=0) $waitSecs = $waitSecs * 1000 $startTime=TimerInit() While TimerDiff($startTime) < $waitSecs for $i = 1 to $findImage[0] sleep(100) $result=_ImageSearch($findImage[$i],$resultPosition,$x, $y,$tolerance,$transparency) if $result > 0 Then return $i EndIf Next WEnd return 0 EndFunc ; find recycle bin if it is in the top left corner of screen ; change 2nd argument to 0 to return the top left coord instead $result = _ImageSearchArea("recycle.bmp",1,0,0,200,200,$x1,$y1,0,0x000000) ;perfect black used as transparency if $result=1 Then MouseMove($x1,$y1,3) MsgBox(0,"Found","Found a recycle bin with stuff in top left corner") EndIf line: $result = _ImageSearchArea("recycle.bmp",1,0,0,200,200,$x1,$y1,0,0x000000) ;perfect black used as transparency why it not found "recycle.bmp" (this bmp file have some transparency 0x000000) someone tell me about transparency parameter? recycle.bmp
×
×
  • Create New...