Search the Community
Showing results for tags 'image'.
-
Button Image - Icon from shell32.dll - rotate
SirWayNe posted a topic in AutoIt GUI Help and Support
Hey, TLDR; Take Image from dll File, rotate as needed, Put into Button Control I want to use Icons from shell32 and Put them into Buttons as Images. So far so easy, Buttons are created with Style BS_ICON and the Image ist set via guictrlsetimage with specific identifier. But the Idea is to use arrows or other Icons from the shell32.dll or different files, but rotating them as needed for the Button controls. Since the Rotation has to be done at runtime, creating the icons in advance wont work. I got a bit lost, using GDI Plus in this. Every attemp i tried, failed in No Icon displayed. But i am not used to GDI Plus at all, that might be the Problem here. When i have access to the current source, i will add this to the topic. Any ideas so far how to solve this? Greetings. -
FileSequence UDF My job requires me everyday to work with a LOT of file sequences, mostly image file sequences. So I created this UDF. I use it to batch convert image sequences to quicktimes, resize, rename, move, backup, count total frames ...etc... I use it for image scanning, but you can use it for any files numbered. Just type in the extention you need. In this UDF, I consider a file sequence to be of more than 3 consecutive files. Example: C:FolderImageSequence_001.tga C:FolderImageSequence_002.tga C:FolderImageSequence_003.tga .... --> C:FolderImageSequence_###.tga Example: If you scan this folder : "C:Folder", looking for extentions like "jpg tga mov", then the function may return an array like this: $array[0] = 3 $array[1] = C:FolderImageSequence_#####.tga $array[2] = C:FolderImageSequence_Converted_####.jpg $array[3] = C:FolderSubFolderquicktime movies ###.mov") You can convert the returned file sequence to format %0id or wildcard with the provided functions: C:FolderImageSequence_###.tga --> C:FolderImageSequence_%03d.tga --> C:FolderImageSequence_***.tga C:FolderImageSequence_######.tga --> C:FolderImageSequence_%06d.tga --> C:FolderImageSequence_******.tga This UDF is a relatively fast folder scanning UDF, scanning ~40 GB with about 100 file sequences (~5000 images) and gathering all the informations (Sequence length, Sequence Range, Dimensions, FileSize ...) takes about 6-7 seconds on my computer. Remark: parts of this UDF require IrfanView, which you can download for free on their website (www.irfanview.com). I am currently converting this part of the UDF to use the FreeImage UDF instead. The UDF also uses "Array.au3" and "GDIPlus.au3". Functions: _FileSequence_Convert (uses IrfanView) _FileSequence_Copy _FileSequence_Delete _FileSequence_Exists _FileSequence_Find (Main function) _FileSequence_FSToRegExp _FileSequence_FSToWildcard _FileSequence_GetFileName _FileSequence_GetImageDimensions _FileSequence_GetParentFolder _FileSequence_GetRange _FileSequence_GetSize _FileSequence_Move _FileSequence_Rename _FileSequence_Resize (uses IrfanView) If you see anything that could be improved, please tell me, I'd be happy to make it even faster! Comments and critics welcome! Tell me what you use it for, I am curious! File_Sequence.au3 File_Sequence_ExampleSimple.au3 File_Sequence_ExampleAdvanced.au3
- 4 replies
-
- file sequence
- udf
-
(and 1 more)
Tagged with:
-
Function Reference _GUIResourcePic.au3 Functions related to the image control in the GUI. Sintax: _GUICtrlPic_Create( FileName, Left, Top [, Width [, Height [, Style [, ExStyle ]]]]]] ) _GUICtrlPic_SetImage( controlID, FileName [, FixSize ]]) _GUICtrlPic_Delete( controlID ) _GUICtrlPic_Release( controlID ) _GUICtrlPic_SetState( controlID, state ) _GUICtrlPic_GetInfo( FileName or Control ID ) Supports: ; Images in the format: .bmp, .jpg, .png, .gif {animated} and other formats of files for resources (.exe, .dll, .ocx, .cpl...). ; For the "resources", use the "FileName" in this format: "MyFile.ext|RessourceName|ResourceType". ; It can be a URL path as well! Download: Version: 1.8.2012.2600b _GUIResourcePic_(RedirectLink).html 17.0k (Previous downloads: 140) Example_Include_HD_GIF_(RedirectLink).html 36.08k (Previous downloads: 135) Note: Added new function! I've made significant changes in the code, including the syntax of some functions! Now uses GDI+ to render the images. Example of use is included! Sample: CPU in 0,60%. http://www.youtube.com/watch?v=NZZB-G9C1Kg Direct download: _GUIResourcePic.mp4 Fixes: $GUI_GIFSTART ; If image is GIF animated, start/resume animation! $GUI_GIFSTOP ; If image is GIF animated, stop/pause animation! ;----> Style (GIS = Gif Image Styles) $GIS_ASPECTRATIOFIX ; Fix the image size based on aspect ratio. $GIS_HALFTRANSPARENCY ; The images are rendered with the window background color. This Style is default. $GIS_FULLTRANSPARENCY ; The frames are rendered in full transparency independent of the background color of the window! Note: This Style consumes more CPU because the exstyle $WS_EX_TRANSPARENT is added to each frame in real time! Not valid if the image does not have transparency! ;----> Default Style to _GUICtrlPic_Create()! $GIS_SS_DEFAULT_PIC = BitOR($GIS_HALFTRANSPARENCY, $SS_NOTIFY) ;----> ExStyle (GIS_EX = Gif Image Extended Styles) $GIS_EX_DEFAULTRENDER ; To use _GUIImageList_Draw in rendering of images, use less CPU. This ExStyle is default! $GIS_EX_CTRLSNDRENDER ; The frames is render using GUICtrlSendMsg, but consumes much more CPU!!! Note: If you use this ExStyle, only $GRP_FULLTRANSPARENCY is used for rendering images! 1.02b 09/05/2012 -> After updating the code, the images with transparency were not being shown as they should, changed code again!09/05/2012 -> Fixes in the _GUICtrlPic_SetImage() function, the measures were not being updated according to the parameter FixSiz , identified by @Belini, thank you!Regards, João Carlos.
- 67 replies
-
- gif
- gif animated
- (and 4 more)
-
Here a small tool to watermark any image supported by GDI+. This version is the enhanced version from AutoIt Windows Screenshooter. Screenshot: Download: AutoIt Watermark Image v0.89 beta build 2014-08-25.7z (942 download previously) Source code is too long to publish here -> PASTEBIN You are not allowed to sell this code or use it or just parts of it in a commercial project or modify it and distribute it with a different name! Some fonts may no be displayed properly because it is not GDI+ compatible! Appreciate any feedback (bugs, feature request, criticisms, etc.). @JScript: I created this on your request Coded and tested on Win7 x64 with Aero and AutoIt v3.3.12.0. Command line parameters Credits: Authenticity (GDIP.au3), funkey (_GetFontInfoFromFilePtr()), Yashied (WinAPIEx.au3) and Melba23 (NoFocusLines.au3) Thanks to (alph. order): davidkim, funkey, JScript and Myicq for active supporting this little project! Br, UEZ History
- 76 replies
-
Dear members of the forum, I'm working on a project in which I have to use Image recognition technique. Due to client restrictions, I couldn't use AutoIt for this project. Is there a way to use this DLL "ImageSearchDLL.dll" (which is used to do image recognition steps in AutoIt) in VB.Net to achieve the same result? I have used this DLL few years before and got good results. If there is a latest version of this DLL and if you can share it, that will be helpful too. Any guidance is deeply appreciated.
- 2 replies
-
- image
- recognition
-
(and 3 more)
Tagged with:
-
Hi, i have an AutoIT script that sends emails with two embedded images. When users get the email they don't see the images. How should I fix my code? Thank you for your support, Amos Func fSendMail() $TemplateName = StringRegExpReplace($Template, "^.*\\|\..*$", "") $SmtpServer = "smtp.**.com" $FromName = "do-not-reply@*********" $FromAddress = "do-not-reply@******" $ToAddress = $MG1_Mgr & ";"& $Owner $Subject = "ACTION REQUIRED - " & $TemplateName $Body = $sBody5 $IPPort = 25 $ssl = 0 Global $oMyRet[2] Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") $rc = fINetSmtpMailCom($SmtpServer, $FromName, $FromAddress, $ToAddress, $Subject, $Body, $IPPort, $ssl) If @error Then MyErrFunc() EndIf EndFunc;fSendMail Func fINetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject = "", $as_Body = "", $IPPort = 25, $ssl = 0) Local $objEmail = ObjCreate("CDO.Message") $objEmail.From = '"' & $s_FromName & '" <' & $s_FromAddress & '>' $objEmail.To = $s_ToAddress Local $i_Error = 0 Local $i_Error_desciption = "" $objEmail.Subject = $s_Subject If StringInStr($as_Body, "<") And StringInStr($as_Body, ">") Then $objEmail.HTMLBody = $as_Body Else $objEmail.Textbody = $as_Body & @CRLF EndIf $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = $s_SmtpServer If Number($IPPort) = 0 Then $IPPort = 25 $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = $IPPort $objEmail.Configuration.Fields.Update $objEmail.Fields.Update ;$objEmail.Send **************** If @error Then MyErrFunc() EndIf $objEmail = "" EndFunc;fINetSmtpMailCom
-
Hello everyone, Im developing an script to check the size of all .jpg stored in windows folder. The problem is that it doesn´t work properly with rotated images. With _GDIPlus_ImageGetWidth() and _GDIPlus_ImageGetHeight() I get the Width and Height of images as if they had not been rotated, and I need to know how they are rotated (orientation and grades). Any help is welcome! If more info is needed, please tell. 😁
-
hello autoit team please i've a question for you. am creating a audio player and in this audio player i want to show the current trac info such as the total time and the position ... etc i know i can show it as label but the screen reader for the blind read the text every change because it have a screen scan what i want is to show this informations but such image or icon i mean i need to create GUICtrlCreatepic or GUICtrlCreateicon .... or some thing as that and show this informations as image on it i think that i can do that with the _GDIPlus functions but i couldn't find the currect way to do it i tried the _GDIPlus_GraphicsDrawString but i couldn't know how it work what i need is a small example that create a GUI and add a multy line text to it as graphic or image. so i need a simple way because it will changed every sec i hope any one can help me to do that global $GUI = GUICreate("text", 400, 400) global $label = GUICtrlCreateLabel(GetText(), 10, 10, 380, 380) GUISetState() do sleep(100) until GUIGetMSG() = -3 exit func GetText() return StringFormat("file name is test.mp3 \r\n total time is 00:30:00 \r\n position is 00:05:50") endFunc
-
So I don't have any code cooked up yet as this is still in the theoretical stage. Just looking for some advice. My current idea is to resize the image to 1x1 pixel, probably using _GDIPlus_ImageResize, and read the color of the resulting pixel to obtain an admittedly very general sense of brightness. Does anyone think this could work? We have a CCTV system running at home using some home made cameras (raspberry pi) and we're trying to automate toggling settings for day/night time. We started with an AutoIt script that checked sunrise and sundown times for our location (calculations pulled from here) and toggled the settings based on that. Unfortunately our weather varies wildly, so it can get light/dark far outside normal sunrise/sundown times. Now we're hoping to periodically grab a still from the camera and toggle the light mode based on that.
-
Here a little script to load a TGA image file and create a GDI+ bitmap. Currently supported TGA formats are 1/8/15/16/24 and 32-bit. As v0.85 is written completely in AutoIt, it might take some time to convert larger 8/15/16/24/32-bit images. ☕ _GDIPlus_TGAImageLoadFromFile.au3 UDF v0.85 without assembler acceleration code but with RLE support: ;Coded by UEZ #AutoIt3Wrapper_UseX64=n #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <WinAPIFiles.au3> ; #FUNCTION# ==================================================================================================================== ; Name ..........: _GDIPlus_TGAImageLoadFromFile ; Description ...: Loads a TGA compressed (RLE) / uncompressed image file (1/8/15/16/24/32-bit) and converts it to a GDI+ bitmap format. ; Syntax ........: _GDIPlus_TGAImageLoadFromFile($sFile[, $bPrintInfo = False.]) ; Parameters ....: $sFile - TGA file name to load from disk. ; $bPrintInfo - [optional] Prints some information about the TGA image to console. Default is False. ; Return values .: Success: GDI+ bitmap handle ; Failure: error 1 - file cannot be opened ; error 2 - TGA image is not in one of these formats: 1/8/15/16/24/32-bit ; error 3 - unsupported TGA image type ; error 4 - unable to read file to struct ; error 5 - unknown TGA pixel depth ; error 6 - return bitmap cannot be created ; Version .......: v0.85 build 2019-11-08 beta ; Author ........: UEZ ; Remarks .......: 8/15/16/24/32-bit images might be slow on converting ^^ ; Related .......: _GDIPlus_BitmapCreateFromScan0, _GDIPlus_ImageRotateFlip, DllStructCreate, _WinAPI_CreateFile, _WinAPI_SetFilePointer ; Link ..........: https://www.loc.gov/preservation/digital/formats/fdd/fdd000180.shtml, http://www.fileformat.info/format/tga/egff.htm ; Example .......: Yes ; =============================================================================================================================== Func _GDIPlus_TGAImageLoadFromFile($sFile, $bPrintInfo = False) Local Const $hFile = _WinAPI_CreateFile($sFile, 2, 2) If Not $hFile Then Return SetError(1, 0, 0) Local Const $tagTGAHeader = "align 1;byte idLength;byte colormapType;byte imageType;word firstEntryIndex;word colormapLength;byte colormapEntrySize;word xOrigin;word yOrigin;word width;word height;byte pixelDepth;byte imageDescriptor" Local Const $tagTGAFooter = "dword extAreaOffset;dword devDirOffset;byte imageID[18]" Local Const $tagTGAExtention = "align 1;word extSize;byte authorName[41];byte authorComments[324];word timeM;word timeD;word timeY;word timeHr;word timeMin;word timeSec;byte jobName[41];word jobTimeHr;word jobTimeMin;word jobTimeSec;byte swID[41];word swVersionNr;byte swVersionLetter;long keyColor;word pxAspectRatioNum;word pxAspectRatioDom;word gammaNum;word gammaDom;dword colCorrOffset;dword postStampOffset;dword scanLineOffset;byte attribType" Local Const $tTGAHeader = DllStructCreate($tagTGAHeader) Local $tTGAFooter = DllStructCreate($tagTGAFooter) Local Const $tTGAExtention = DllStructCreate($tagTGAExtention) Local $dwBytesRead, $tTGAImageID, $tagTGAImageID, $iColorValuesStartPos = 0 _WinAPI_ReadFile($hFile, $tTGAHeader, DllStructGetSize($tTGAHeader), $dwBytesRead) $iColorValuesStartPos += $dwBytesRead If $tTGAHeader.idLength > 0 Then $tagTGAImageID = "byte imageID[" & $tTGAHeader.idLength & "]" $tTGAImageID = DllStructCreate($tagTGAImageID) _WinAPI_ReadFile($hFile, $tTGAImageID, $tTGAHeader.idLength, $dwBytesRead) $iColorValuesStartPos += $dwBytesRead EndIf Local Const $iPxDepth = $tTGAHeader.pixelDepth If Not BitOR($iPxDepth = 32, $iPxDepth = 24, $iPxDepth = 16, $iPxDepth = 15, $iPxDepth = 8, $iPxDepth = 1) Then _WinAPI_CloseHandle($hFile) Return SetError(2, 0, 0) EndIf #cs ImageType Image Data Type Colormap Encoding 0 No image data included in file No No 1 Colormapped image data Yes No 2 Truecolor image data No No 3 Monochrome image data No No 9 Colormapped image data Yes Yes 10 Truecolor image data No Yes 11 Monochrome image data No Yes #ce If Not BitOR($tTGAHeader.imageType = 0x01, $tTGAHeader.imageType = 0x02, $tTGAHeader.imageType = 0x03, $tTGAHeader.imageType = 0x09, $tTGAHeader.imageType = 0x0A, $tTGAHeader.imageType = 0x0B) Then _WinAPI_CloseHandle($hFile) Return SetError(3, 0, 0) EndIf Local $iW = $tTGAHeader.width, $iH = $tTGAHeader.height, $colorwidth = $tTGAHeader.colormapEntrySize / 8, _ $colorTblSize = $tTGAHeader.colormapLength * $colorwidth Local $dwBufferSize = FileGetSize($sFile) Local $tSrcBmp = DllStructCreate("ubyte color[" & $dwBufferSize & "]") _WinAPI_ReadFile($hFile, $tSrcBmp, $dwBufferSize, $dwBytesRead) _WinAPI_SetFilePointer($hFile, -26, $FILE_END) _WinAPI_ReadFile($hFile, $tTGAFooter, 26, $dwBytesRead) Local $sFooter = StringTrimRight(BinaryToString($tTGAFooter.imageID), 1), $iOffset = 0, $iOffset2, $iOffset3 If Not StringCompare($sFooter, "TRUEVISION-XFILE.") Then ;read extension information to struct if available $iOffset = $tTGAFooter.extAreaOffset _WinAPI_SetFilePointer($hFile, $iOffset, $FILE_BEGIN) _WinAPI_ReadFile($hFile, $tTGAExtention, 0x01EF, $dwBytesRead) Else $tTGAFooter.extAreaOffset = 0 EndIf _WinAPI_CloseHandle($hFile) If $dwBytesRead = 0 Then Return SetError(4, _WinAPI_GetLastError(), 0) Local $bRLE = BitOR($tTGAHeader.imageType = 0x09, $tTGAHeader.imageType = 0x0A, $tTGAHeader.imageType = 0x0B) If $bPrintInfo Then ConsoleWrite("idLength: " & $tTGAHeader.idLength & @CRLF) ConsoleWrite("colormapType: " & $tTGAHeader.colormapType & @CRLF) ConsoleWrite("imageType: " & $tTGAHeader.imageType & @CRLF) ConsoleWrite("firstEntryIndex: " & $tTGAHeader.firstEntryIndex & @CRLF) ConsoleWrite("colormapLength: " & $tTGAHeader.colormapLength & @CRLF) ConsoleWrite("colormapEntrySize: " & $tTGAHeader.colormapEntrySize & @CRLF) ConsoleWrite("xOrigin: " & $tTGAHeader.xOrigin & @CRLF) ConsoleWrite("yOrigin: " & $tTGAHeader.yOrigin & @CRLF) ConsoleWrite("width: " & $tTGAHeader.width & @CRLF) ConsoleWrite("height: " & $tTGAHeader.height & @CRLF) ConsoleWrite("pixelDepth: " & $iPxDepth & @CRLF) ConsoleWrite("imageDescriptor: " & $tTGAHeader.imageDescriptor & @CRLF) If $tTGAHeader.idLength > 0 Then ConsoleWrite("ImageID: " & RemoveNullChars($tTGAImageID.imageID) & @CRLF) If $iOffset Then ConsoleWrite("authorName: " & RemoveNullChars($tTGAExtention.authorName) & @CRLF) ConsoleWrite("authorComments: " & RemoveNullChars($tTGAExtention.authorComments) & @CRLF) ConsoleWrite("jobName: " & RemoveNullChars($tTGAExtention.jobName) & @CRLF) ConsoleWrite("swID: " & RemoveNullChars($tTGAExtention.swID) & @CRLF) EndIf ConsoleWrite("RLE packed: " & $bRLE & @CRLF) EndIf Local Static $tDestBmp ;must be static otherwise bitmap data might get corrupted or in worst case script will crash Local $stride, $iPixelFormat Switch $iPxDepth Case 1 ;1-bit $iPixelFormat = $GDIP_PXF01INDEXED $stride = BitAND(($iW * 1) + 1, BitNOT(1)) $tDestBmp = DllStructCreate("uint color[" & $stride * $iH & "];") Case 8, 24 $iPixelFormat = $GDIP_PXF24RGB $stride = BitAND(($iW * 3) + 3, BitNOT(3)) $tDestBmp = DllStructCreate("ubyte color[" & $stride * $iH & "];") Case 15, 16 $iPixelFormat = $GDIP_PXF16RGB555 $stride = BitAND(($iW * 2) + 2, BitNOT(2)) $tDestBmp = DllStructCreate("ubyte color[" & $stride * $iH & "];") Case 32 $iPixelFormat = $GDIP_PXF32ARGB $stride = $iW * 4 $tDestBmp = DllStructCreate("ubyte color[" & $stride * $iH & "];") Case Else Return SetError(5, 0, 0) EndSwitch If Mod($stride, 4) <> 0 Then $stride += 4 - Mod($stride, 4) Local Const $hBitmap = _GDIPlus_BitmapCreateFromScan0($iW, $iH, $iPixelFormat, $stride, $tDestBmp) If @error Or Not $hBitmap Then Return SetError(6, @error, 0) Local $c, $q, $x, $y, $t1, $t2, $t3, $t4, $col, $red, $green, $blue, $alpha, $iLen, $iStart, $iEnd, $iLength, $iWW Local Const $hDLL = DllOpen("msvcrt.dll") Switch $iPxDepth Case 1 ;1-bit For $y = 0 To $iH - 1 $t1 = $y * $stride DllCall($hDLL, "ptr:cdecl", "memcpy", "ptr", DllStructGetPtr($tDestBmp) + $t1, "ptr", DllStructGetPtr($tSrcBmp) + BitShift($t1, 3), "uint", $stride) Next Case 8 ;8-bit ;if a color table is available, just use it If $tTGAHeader.colormapType = 1 Then Local $tMapColorTbl = DllStructCreate("ubyte bgr[" & $colorTblSize & "]", DllStructGetPtr($tSrcBmp, "color") + $tTGAHeader.firstEntryIndex) Switch $bRLE Case 0 For $y = 0 To ($iH - 1) $iOffset = $y * $iW + $colorTblSize $iOffset2 = $y * $stride For $x = 0 To ($iW - 1) $t1 = $iOffset2 + $x * 3 $t2 = $tSrcBmp.color($iOffset + $x + 1) * $colorwidth Switch $colorwidth Case 3, 4 $tDestBmp.color($t1 + 1) = $tMapColorTbl.bgr($t2 + 1) $tDestBmp.color($t1 + 2) = $tMapColorTbl.bgr($t2 + 2) $tDestBmp.color($t1 + 3) = $tMapColorTbl.bgr($t2 + 3) Case 2 ;convert from RGB555 to RGB $col = BitOR(BitShift($tMapColorTbl.bgr($t2 + 2), -8), $tMapColorTbl.bgr($t2 + 1)) ;RGB555 $tDestBmp.color($t1 + 1) = BitShift(BitAND($col, 0x001F), -3) ;B $tDestBmp.color($t1 + 2) = BitShift(BitShift(BitAND($col, 0x03E0), 5), -3) ;G $tDestBmp.color($t1 + 3) = BitShift(BitShift(BitAND($col, 0x7C00), 10), -3) ;R EndSwitch Next Next Case Else ;RLE encoded TGA images $c = 0 $x = 0 $y = 0 $iOffset = $colorTblSize + 1 $iStart = Int($iColorValuesStartPos + $colorTblSize) $iEnd = $tTGAFooter.extAreaOffset > 0 ? $tTGAFooter.extAreaOffset : $dwBufferSize $iLength = $iEnd - $iStart - 1 $iWW = $iW - 1 $t3 = $colorwidth = 2 ? 2 : 3 While $c <= $iLength $iOffset2 = Int($tSrcBmp.color($iOffset + $c)) $iLen = BitAND($iOffset2, 0x7F) + 1 If BitAND($iOffset2, 0x80) Then ; check for packet format ;run length packet format $c += 1 $iOffset3 = Int($tSrcBmp.color($iOffset + $c)) * $t3 $t2 = $y * $stride For $q = 1 To $iLen $t1 = $t2 + $x * 3 Switch $colorwidth Case 3, 4 $tDestBmp.color($t1 + 1) = $tMapColorTbl.bgr($iOffset3 + 1) $tDestBmp.color($t1 + 2) = $tMapColorTbl.bgr($iOffset3 + 2) $tDestBmp.color($t1 + 3) = $tMapColorTbl.bgr($iOffset3 + 3) Case 2 ;convert from RGB555 to RGB $col = BitOR(BitShift($tMapColorTbl.bgr($iOffset3 + 2), -8), $tMapColorTbl.bgr($iOffset3 + 1)) ;RGB555 $tDestBmp.color($t1 + 1) = BitShift(BitAND($col, 0x001F), -3) ;B $tDestBmp.color($t1 + 2) = BitShift(BitShift(BitAND($col, 0x03E0), 5), -3) ;G $tDestBmp.color($t1 + 3) = BitShift(BitShift(BitAND($col, 0x7C00), 10), -3) ;R EndSwitch $x += 1 If $x > $iWW Then $x = 0 $y += 1 $t2 = $y * $stride EndIf Next $c += 1 Else ;raw packet format $c += 1 $t2 = $y * $stride For $q = 1 To $iLen $iOffset3 = Int($tSrcBmp.color($iOffset + $c)) * $t3 $t1 = $t2 + $x * 3 Switch $colorwidth Case 3, 4 $tDestBmp.color($t1 + 1) = $tMapColorTbl.bgr($iOffset3 + 1) $tDestBmp.color($t1 + 2) = $tMapColorTbl.bgr($iOffset3 + 2) $tDestBmp.color($t1 + 3) = $tMapColorTbl.bgr($iOffset3 + 3) Case 2 ;convert from RGB555 to RGB $col = BitOR(BitShift($tMapColorTbl.bgr($iOffset3 + 2), -8), $tMapColorTbl.bgr($iOffset3 + 1)) ;RGB555 $tDestBmp.color($t1 + 1) = BitShift(BitAND($col, 0x001F), -3) ;B $tDestBmp.color($t1 + 2) = BitShift(BitShift(BitAND($col, 0x03E0), 5), -3) ;G $tDestBmp.color($t1 + 3) = BitShift(BitShift(BitAND($col, 0x7C00), 10), -3) ;R EndSwitch $x += 1 If $x > $iWW Then $x = 0 $y += 1 $t2 = $y * $stride EndIf $c += 1 Next EndIf WEnd EndSwitch Else ;convert it to grayscale Switch $bRLE Case 0 For $y = 0 To $iH - 1 $iOffset = $y * $iW + $colorTblSize $iOffset2 = $y * $stride For $x = 0 To $iW - 1 $t1 = $iOffset + $x - 2 $t2 = $iOffset2 + $x * 3 $blue = $tSrcBmp.color($t1 + 1) $green = $tSrcBmp.color($t1 + 2) $red = $tSrcBmp.color($t1 + 3) $col = $red $col = $col < 0 ? 0 : $col > 255 ? 255 : $col $tDestBmp.color($t2 + 1) = $col $tDestBmp.color($t2 + 2) = $col $tDestBmp.color($t2 + 3) = $col Next Next Case Else $c = 0 $x = 0 $y = 0 $iOffset = $colorTblSize + 1 $iStart = Int($iColorValuesStartPos + $colorTblSize) $iEnd = $tTGAFooter.extAreaOffset > 0 ? $tTGAFooter.extAreaOffset : $dwBufferSize $iLength = $iEnd - $iStart - 1 $iWW = $iW - 1 While $c <= $iLength $iOffset2 = Int($tSrcBmp.color($iOffset + $c)) $iLen = BitAND($iOffset2, 0x7F) + 1 If BitAND($iOffset2, 0x80) Then ; check for packet format ;run length packet format $c += 1 $iOffset3 = Int($tSrcBmp.color($iOffset + $c)) * 3 $blue = $iOffset3 $green = $iOffset3 + 1 $red = $iOffset3 + 2 $col = ($red + $green + $blue) / 9 $col = $col < 0 ? 0 : $col > 255 ? 255 : $col $t2 = $y * $stride For $q = 1 To $iLen $t1 = $t2 + $x * 3 $tDestBmp.color($t1 + 1) = $col $tDestBmp.color($t1 + 2) = $col $tDestBmp.color($t1 + 3) = $col $x += 1 If $x > $iWW Then $x = 0 $y += 1 $t2 = $y * $stride EndIf Next $c += 1 Else ;raw packet format $c += 1 $t2 = $y * $stride For $q = 1 To $iLen $iOffset3 = Int($tSrcBmp.color($iOffset + $c)) * 3 $blue = $iOffset3 $green = $iOffset3 + 1 $red = $iOffset3 + 2 $col = ($red + $green + $blue) / 9 $col = $col < 0 ? 0 : $col > 255 ? 255 : $col $t1 = $t2 + $x * 3 $tDestBmp.color($t1 + 1) = $col $tDestBmp.color($t1 + 2) = $col $tDestBmp.color($t1 + 3) = $col $x += 1 If $x > $iWW Then $x = 0 $y += 1 $t2 = $y * $stride EndIf $c += 1 Next EndIf WEnd EndSwitch EndIf Case 15, 16, 24, 32 ;15/16/24/32-bit, as the bitmap format is the same we can use memcpy to copy the pixel data directly to the memory. ;Exeptions are 15/16/24-bit images whose width is not a divider of 4! If BitOR($iPxDepth = 15, $iPxDepth = 16, $iPxDepth = 24) Then If BitOR(Mod($iW, 4), $bRLE) Then Switch $iPxDepth Case 15, 16 Switch $bRLE Case 0 $t4 = $iW * 2 For $y = 0 To ($iH - 1) $iOffset = $y * $t4 $iOffset2 = $y * $stride For $x = 0 To ($iW - 1) $t3 = $x * 2 $t1 = $iOffset + $t3 $t2 = $iOffset2 + $t3 ;RGB555 $tDestBmp.color($t2 + 1) = $tSrcBmp.color($t1 + $colorTblSize + 1) $tDestBmp.color($t2 + 2) = $tSrcBmp.color($t1 + $colorTblSize + 2) Next Next Case Else $c = 0 $x = 0 $y = 0 $iStart = Int($iColorValuesStartPos + $colorTblSize) $iEnd = $tTGAFooter.extAreaOffset > 0 ? $tTGAFooter.extAreaOffset : $dwBufferSize $iLength = $iEnd - $iStart - 1 $iWW = $iW - 1 While $c <= $iLength $iOffset2 = Int($tSrcBmp.color($colorTblSize + $c + 1)) $iLen = BitAND($iOffset2, 0x7F) + 1 If BitAND($iOffset2, 0x80) Then ; check for packet format ;run length packet format $c += 1 $t3 = $y * $stride For $q = 1 To $iLen $t1 = $t3 + $x * 2 $t2 = $colorTblSize + $c $tDestBmp.color($t1 + 1) = $tSrcBmp.color($t2 + 1) $tDestBmp.color($t1 + 2) = $tSrcBmp.color($t2 + 2) $x += 1 If $x > $iWW Then $x = 0 $y += 1 $t3 = $y * $stride EndIf Next $c += 2 Else ;raw packet format $c += 1 $t3 = $y * $stride For $q = 1 To $iLen $t1 = $t3 + $x * 2 $t2 = $colorTblSize + $c $tDestBmp.color($t1 + 1) = $tSrcBmp.color($t2 + 1) $tDestBmp.color($t1 + 2) = $tSrcBmp.color($t2 + 2) $x += 1 If $x > $iWW Then $x = 0 $y += 1 $t3 = $y * $stride EndIf $c += 2 Next EndIf WEnd EndSwitch Case 24 Switch $bRLE Case 0 $t4 = $iW * 3 For $y = 0 To $iH - 1 $iOffset = $y * $t4 $iOffset2 = $y * $stride For $x = 0 To ($iW - 1) $t3 = $x * 3 $t1 = $iOffset + $t3 $blue = $tSrcBmp.color($t1 + 1) $green = $tSrcBmp.color($t1 + 2) $red = $tSrcBmp.color($t1 + 3) $t2 = $iOffset2 + $t3 $tDestBmp.color($t2 + 1) = $blue $tDestBmp.color($t2 + 2) = $green $tDestBmp.color($t2 + 3) = $red Next Next Case Else $c = 0 $x = 0 $y = 0 $iStart = Int($iColorValuesStartPos + $colorTblSize) $iEnd = $tTGAFooter.extAreaOffset > 0 ? $tTGAFooter.extAreaOffset : $dwBufferSize $iLength = $iEnd - $iStart - 1 $iWW = $iW - 1 While $c <= $iLength $iOffset2 = Int($tSrcBmp.color($c + 1)) $iLen = BitAND($iOffset2, 0x7F) + 1 If BitAND($iOffset2, 0x80) Then ; check for packet format ;run length packet format $c += 1 $blue = $tSrcBmp.color($c + 1) $green = $tSrcBmp.color($c + 2) $red = $tSrcBmp.color($c + 3) $t2 = $y * $stride For $q = 1 To $iLen $t1 = $t2 + $x * 3 $tDestBmp.color($t1 + 1) = $blue $tDestBmp.color($t1 + 2) = $green $tDestBmp.color($t1 + 3) = $red $x += 1 If $x > $iWW Then $x = 0 $y += 1 $t2 = $y * $stride EndIf Next $c += 3 Else ;raw packet format $c += 1 $t2 = $y * $stride For $q = 1 To $iLen $blue = $tSrcBmp.color($c + 1) $green = $tSrcBmp.color($c + 2) $red = $tSrcBmp.color($c + 3) $t1 = $t2 + $x * 3 $tDestBmp.color($t1 + 1) = $blue $tDestBmp.color($t1 + 2) = $green $tDestBmp.color($t1 + 3) = $red $x += 1 If $x > $iWW Then $x = 0 $y += 1 $t2 = $y * $stride EndIf $c += 3 Next EndIf WEnd EndSwitch EndSwitch Else For $y = 0 To $iH - 1 $t1 = $y * $stride DllCall($hDLL, "ptr:cdecl", "memcpy", "ptr", DllStructGetPtr($tDestBmp) + $t1, "ptr", DllStructGetPtr($tSrcBmp) + $t1, "uint", $stride) Next EndIf Else Switch $bRLE Case 0 For $y = 0 To $iH - 1 $t1 = $y * $stride DllCall($hDLL, "ptr:cdecl", "memcpy", "ptr", DllStructGetPtr($tDestBmp) + $t1, "ptr", DllStructGetPtr($tSrcBmp) + $t1, "uint", $stride) Next Case Else $c = 0 $x = 0 $y = 0 $iStart = Int($iColorValuesStartPos + $colorTblSize) $iEnd = $tTGAFooter.extAreaOffset > 0 ? $tTGAFooter.extAreaOffset : $dwBufferSize $iLength = $iEnd - $iStart - 1 $iWW = $iW - 1 While $c <= $iLength $iOffset2 = Int($tSrcBmp.color($c + 1)) $iLen = BitAND($iOffset2, 0x7F) + 1 If BitAND($iOffset2, 0x80) Then ; check for packet format ;run length packet format $c += 1 $blue = $tSrcBmp.color($c + 1) $green = $tSrcBmp.color($c + 2) $red = $tSrcBmp.color($c + 3) $alpha = $tSrcBmp.color($c + 4) $t2 = $y * $stride For $q = 1 To $iLen $t1 = $t2 + $x * 4 $tDestBmp.color($t1 + 1) = $blue $tDestBmp.color($t1 + 2) = $green $tDestBmp.color($t1 + 3) = $red $tDestBmp.color($t1 + 4) = $alpha $x += 1 If $x > $iWW Then $x = 0 $y += 1 $t2 = $y * $stride EndIf Next $c += 4 Else ;raw packet format $c += 1 $t2 = $y * $stride For $q = 1 To $iLen $blue = $tSrcBmp.color($c + 1) $green = $tSrcBmp.color($c + 2) $red = $tSrcBmp.color($c + 3) $alpha = $tSrcBmp.color($c + 4) $t1 = $t2 + $x * 4 $tDestBmp.color($t1 + 1) = $blue $tDestBmp.color($t1 + 2) = $green $tDestBmp.color($t1 + 3) = $red $tDestBmp.color($t1 + 4) = $alpha $x += 1 If $x > $iWW Then $x = 0 $y += 1 $t2 = $y * $stride EndIf $c += 4 Next EndIf WEnd EndSwitch EndIf EndSwitch DllClose($hDLL) ;TGA image is stored bottom up in file. Need to flip it. If BitAND($tTGAHeader.imageDescriptor, 0x30) <> 0x20 Then _GDIPlus_ImageRotateFlip($hBitmap, $GDIP_Rotate180FlipX) $tSrcBmp = 0 Return $hBitmap EndFunc ;==>_GDIPlus_TGAImageLoadFromFile ; #INTERNAL_USE_ONLY# =========================================================================================================== ; Name ..........: RemoveNullChars ; Description ...: Converts a null terminated binary string to a string ; Author ........: UEZ ; =============================================================================================================================== Func RemoveNullChars($bin) Local $a = StringRegExp($bin, "[[:xdigit:]+]{2}", 3), $s, $i If @error Then Return $s For $i = 0 To UBound($a) - 1 If $a[$i] = "00" Then ExitLoop $s &= Chr(Dec($a[$i])) Next Return $s EndFunc ;==>RemoveNullChars ;------------- Example ------------- Global $sFile = FileOpenDialog("Select a TGA file", "", "TGA image(*.tga)") If @error Then Exit _GDIPlus_Startup() Global $endtime, $timer = TimerInit() Global $hImage = _GDIPlus_TGAImageLoadFromFile($sFile, True) If @error Then ConsoleWrite(@error & " / " & @extended & @CRLF) _GDIPlus_Shutdown() Exit EndIf $endtime = TimerDiff($timer) ;~ _GDIPlus_ImageSaveToFile($hImage, @ScriptDir & "\Converted.png") ;~ ShellExecute(@ScriptDir & "\Converted.png") Global $iW = _GDIPlus_ImageGetWidth($hImage), $iH = _GDIPlus_ImageGetHeight($hImage) Global $hGui = GUICreate("TGA Image Loader by UEZ", $iW, $iH) GUISetState() Global $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGui) _GDIPlus_GraphicsDrawImageRect($hGraphics, $hImage, 0, 0, $iW, $iH) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE _GDIPlus_BitmapDispose($hImage) _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_Shutdown() Exit Case $GUI_EVENT_RESTORE _GDIPlus_GraphicsDrawImageRect($hGraphics, $hImage, 0, 0, $iW, $iH) EndSwitch WEnd v0.80 with assembler acceleration (thanks to AndyG for Assembleit2) but without RLE support yet: ;Coded by UEZ #AutoIt3Wrapper_Compile_Both=y #AutoIt3Wrapper_UseX64=n #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <Memory.au3> #include <WinAPIFiles.au3> ; #FUNCTION# ==================================================================================================================== ; Name ..........: _GDIPlus_TGAImageLoadFromFile ; Description ...: Loads an uncompressed TGA image file (1/8/15/16/24/32-bit) and converts it to a GDI+ bitmap format. ; Syntax ........: _GDIPlus_TGAImageLoadFromFile($sFile[, $bPrintInfo = False.]) ; Parameters ....: $sFile - TGA file name to load from disk. ; $bPrintInfo - [optional] Prints some information about the TGA image to console. Default is False. ; Return values .: Success: GDI+ bitmap handle ; Failure: error 1 - file cannot be opened ; error 2 - TGA image is not in one of these formats: 1/8/15/16/24/32-bit ; error 3 - unsupported TGA image type ; error 4 - unable to read file to struct ; error 5 - unknown TGA pixel depth ; error 6 - return bitmap cannot be created ; Version .......: v0.80 build 2019-10-23 beta ; Author ........: UEZ - thanks to AndyG for Assembleit2 ; Remarks .......: No RLE compressed TGA image support yet! ; Related .......: _GDIPlus_BitmapCreateFromScan0, _GDIPlus_ImageRotateFlip, DllStructCreate, _WinAPI_CreateFile, _WinAPI_SetFilePointer ; Link ..........: https://www.loc.gov/preservation/digital/formats/fdd/fdd000180.shtml, http://www.fileformat.info/format/tga/egff.htm ; Example .......: Yes ; =============================================================================================================================== Func _GDIPlus_TGAImageLoadFromFile($sFile, $bPrintInfo = False) Local Const $hFile = _WinAPI_CreateFile($sFile, 2, 2) If Not $hFile Then Return SetError(1, 0, 0) Local Const $tagTGAHeader = "align 1;byte idLength;byte colormapType;byte imageType;word firstEntryIndex;word colormapLength;byte colormapEntrySize;word xOrigin;word yOrigin;word width;word height;byte pixelDepth;byte imageDescriptor" Local Const $tagTGAFooter = "dword extAreaOffset;dword devDirOffset;byte imageID[18]" Local Const $tagTGAExtention = "align 1;word extSize;byte authorName[41];byte authorComments[324];word timeM;word timeD;word timeY;word timeHr;word timeMin;word timeSec;byte jobName[41];word jobTimeHr;word jobTimeMin;word jobTimeSec;byte swID[41];word swVersionNr;byte swVersionLetter;long keyColor;word pxAspectRatioNum;word pxAspectRatioDom;word gammaNum;word gammaDom;dword colCorrOffset;dword postStampOffset;dword scanLineOffset;byte attribType" Local Const $tTGAHeader = DllStructCreate($tagTGAHeader) Local Const $tTGAFooter = DllStructCreate($tagTGAFooter) Local Const $tTGAExtention = DllStructCreate($tagTGAExtention) Local $dwBytesRead, $tTGAImageID, $tagTGAImageID _WinAPI_ReadFile($hFile, $tTGAHeader, DllStructGetSize($tTGAHeader), $dwBytesRead) If $tTGAHeader.idLength > 0 Then $tagTGAImageID = "byte imageID[" & $tTGAHeader.idLength & "]" $tTGAImageID = DllStructCreate($tagTGAImageID) _WinAPI_ReadFile($hFile, $tTGAImageID, $tTGAHeader.idLength, $dwBytesRead) EndIf Local Const $iPxDepth = $tTGAHeader.pixelDepth If Not BitOR($iPxDepth = 32, $iPxDepth = 24, $iPxDepth = 16, $iPxDepth = 15, $iPxDepth = 8, $iPxDepth = 1) Then _WinAPI_CloseHandle($hFile) Return SetError(2, 0, 0) EndIf #cs ImageType Image Data Type Colormap Encoding 0 No image data included in file No No 1 Colormapped image data Yes No 2 Truecolor image data No No 3 Monochrome image data No No 9 Colormapped image data Yes Yes 10 Truecolor image data No Yes 11 Monochrome image data No Yes #ce If Not BitOR($tTGAHeader.imageType = 0x01, $tTGAHeader.imageType = 0x02, $tTGAHeader.imageType = 0x03) Then _WinAPI_CloseHandle($hFile) Return SetError(3, 0, 0) EndIf Local $iW = $tTGAHeader.width, $iH = $tTGAHeader.height, $bytesPerPixel = $iPxDepth / 8, $colorwidth = $tTGAHeader.colormapEntrySize / 8, _ $colorTblSize = $tTGAHeader.colormapLength * $colorwidth If $tTGAHeader.colormapEntrySize < 24 Then $bytesPerPixel = 4 Local Const $dwBufferSize = FileGetSize($sFile) Local $tSrcBmp = DllStructCreate("ubyte color[" & $dwBufferSize + $colorTblSize & "]") _WinAPI_ReadFile($hFile, $tSrcBmp, $dwBufferSize + $colorTblSize, $dwBytesRead) _WinAPI_SetFilePointer($hFile, -26, $FILE_END) _WinAPI_ReadFile($hFile, $tTGAFooter, 26, $dwBytesRead) Local $sFooter = StringTrimRight(BinaryToString($tTGAFooter.imageID), 1), $iOffset = 0, $iOffset2 If Not StringCompare($sFooter, "TRUEVISION-XFILE.") Then ;read extension information to struct if available $iOffset = $tTGAFooter.extAreaOffset _WinAPI_SetFilePointer($hFile, $iOffset, $FILE_BEGIN) _WinAPI_ReadFile($hFile, $tTGAExtention, 0x01EF, $dwBytesRead) EndIf _WinAPI_CloseHandle($hFile) If $dwBytesRead = 0 Then Return SetError(4, _WinAPI_GetLastError(), 0) If $bPrintInfo Then ConsoleWrite("idLength: " & $tTGAHeader.idLength & @CRLF) ConsoleWrite("colormapType: " & $tTGAHeader.colormapType & @CRLF) ConsoleWrite("imageType: " & $tTGAHeader.imageType & @CRLF) ConsoleWrite("firstEntryIndex: " & $tTGAHeader.firstEntryIndex & @CRLF) ConsoleWrite("colormapLength: " & $tTGAHeader.colormapLength & @CRLF) ConsoleWrite("colormapEntrySize: " & $tTGAHeader.colormapEntrySize & @CRLF) ConsoleWrite("xOrigin: " & $tTGAHeader.xOrigin & @CRLF) ConsoleWrite("yOrigin: " & $tTGAHeader.yOrigin & @CRLF) ConsoleWrite("width: " & $tTGAHeader.width & @CRLF) ConsoleWrite("height: " & $tTGAHeader.height & @CRLF) ConsoleWrite("pixelDepth: " & $iPxDepth & @CRLF) ConsoleWrite("imageDescriptor: " & $tTGAHeader.imageDescriptor & @CRLF) If $tTGAHeader.idLength > 0 Then ConsoleWrite("ImageID: " & RemoveNullChars($tTGAImageID.imageID) & @CRLF) If $iOffset Then ConsoleWrite("authorName: " & RemoveNullChars($tTGAExtention.authorName) & @CRLF) ConsoleWrite("authorComments: " & RemoveNullChars($tTGAExtention.authorComments) & @CRLF) ConsoleWrite("jobName: " & RemoveNullChars($tTGAExtention.jobName) & @CRLF) ConsoleWrite("swID: " & RemoveNullChars($tTGAExtention.swID) & @CRLF) EndIf EndIf Local Static $tDestBmp ;must be static otherwise bitmap data might get corrupted or in worst case script will crash Local $stride, $iPixelFormat Switch $iPxDepth Case 1 ;1-bit $iPixelFormat = $GDIP_PXF01INDEXED $stride = BitAND(($iW * 1) + 1, BitNOT(1)) $tDestBmp = DllStructCreate("uint color[" & $stride * $iH + 1 & "];") Case 8, 24 $iPixelFormat = $GDIP_PXF24RGB $stride = BitAND(($iW * 3) + 3, BitNOT(3)) $tDestBmp = DllStructCreate("uint color[" & $stride * $iH + 1 & "];") Case 15, 16 $iPixelFormat = $GDIP_PXF16RGB555 $stride = BitAND(($iW * 2) + 2, BitNOT(2)) $tDestBmp = DllStructCreate("uint color[" & $stride * $iH + 1 & "];") Case 32 $iPixelFormat = $GDIP_PXF32ARGB $stride = $iW * 4 $tDestBmp = DllStructCreate("uint color[" & $stride * $iH + 1 & "];") Case Else Return SetError(5, 0, 0) EndSwitch If Mod($stride, 4) <> 0 Then $stride += 4 - Mod($stride, 4) Local Const $hBitmap = _GDIPlus_BitmapCreateFromScan0($iW, $iH, $iPixelFormat, $stride, $tDestBmp) If @error Or Not $hBitmap Then Return SetError(6, @error, 0) Local $fTimer = TimerInit() Local $x, $x1, $y, $t1 Local Const $hDLL = DllOpen("msvcrt.dll") Local Const $tagParam = "ptr tSrcBmp;ptr tDestBmp;dword strideSrc;dword strideDest;dword w;dword h;dword colorTblSize;dword t1;dword t2" Local $tParam If @AutoItX64 Then $tParam = _DLLStructCreate64($tagParam) Else $tParam = DLLStructCreate($tagParam) EndIf $tParam.tSrcBmp = DllStructGetPtr($tSrcBmp) $tParam.tDestBmp = DllStructGetPtr($tDestBmp) $tParam.strideDest = $stride $tParam.w = ($iW - 1) $tParam.h = ($iH - 1) $tParam.colorTblSize = $colorTblSize Switch $iPxDepth Case 1 ;1-bit For $y = 0 To $iH - 1 $t1 = $y * $stride DllCall($hDLL, "ptr:cdecl", "memcpy", "ptr", DllStructGetPtr($tDestBmp) + $t1, "ptr", DllStructGetPtr($tSrcBmp) + BitShift($t1, 3), "uint", $stride) Next Case 8 ;8-bit ConsoleWrite("Using Assembler code to speed-up..." & @CRLF) ;if a color table is available, just use it If $tTGAHeader.colormapType = 1 Then Local $tMapColorTbl = DllStructCreate("ubyte bgr[" & $colorTblSize & "]", DllStructGetPtr($tSrcBmp, "color") + $tTGAHeader.firstEntryIndex) Local $tParam2, $tagParam2 = "align 1;ptr tSrcBmp;ptr tDestBmp;ptr colormap;dword strideSrc;dword strideDest;dword w;dword h;dword colorTblSize;dword colorwidth;dword t1;dword t2;byte r5;byte g5;byte b5;" If @AutoItX64 Then $tParam2 = _DLLStructCreate64($tagParam2) Else $tParam2 = DllStructCreate($tagParam2) EndIf $tParam2.tSrcBmp = DllStructGetPtr($tSrcBmp) $tParam2.tDestBmp = DllStructGetPtr($tDestBmp) $tParam2.colormap = DllStructGetPtr($tMapColorTbl) $tParam2.strideSrc = $iW $tParam2.strideDest = $stride $tParam2.colorwidth = $colorwidth $tParam2.w = ($iW - 1) $tParam2.h = ($iH - 1) $tParam2.colorTblSize = $colorTblSize Switch @AutoItX64 Case False Local Const $bBinASM8cm_x86 = Binary("0x608B7C242431C990909090909090909089C8F7670C03471C89472489C8F7671089472831DB8B472401D8030789C231C08A02F767208B570801C28B32B803000000F7E303472803470489C5837F200275476689F26683E21F66C1E20388572E6689F26681E2E00366C1EA0566C1E20388572D6689F26681E2007C66C1EA0A66C1E20388572C31C00A472CC1E0080A472DC1E0080A472E89C6897500433B5F147684413B4F180F8665FFFFFF61C20400") Local $tBinASM8cm_x86 = DllStructCreate("ubyte asm[" & BinaryLen($bBinASM8cm_x86) & "]") $tBinASM8cm_x86.asm = $bBinASM8cm_x86 DllCallAddress("none", DllStructGetPtr($tBinASM8cm_x86), "ptr", DllStructGetPtr($tParam2)) Case Else Local Const $bBinASM8cm_x64 = Binary("0x575653554989CF41BE000000009090904489F041F7671841034728418947304489F041F7671C418947344531ED418B47304401E84903074889C24831C08A0241F7672C498B57104801C2448B0A4831C048C7C00300000041F7E541034734490347084989C041837F2C02755A4831D2664489CA6683E21F66C1E2034188573A4831D2664489CA6681E2E00366C1EA0566C1E203418857394831D2664489CA6681E2007C66C1EA0A66C1E2034188573831C0410A4738C1E008410A4739C1E008410A473A4189C145890841FFC5453B6F200F8657FFFFFF41FFC6453B77240F862DFFFFFF5D5B5E5FC20800") Local $tBinASM8cm_x64 = _DLLStructCreate64("ubyte asm[" & BinaryLen($bBinASM8cm_x64) & "]") $tBinASM8cm_x64.asm = $bBinASM8cm_x64 DllCallAddress("none", DllStructGetPtr($tBinASM8cm_x64), "ptr", DllStructGetPtr($tParam2)) EndSwitch Else ;convert it 1:1 directly Switch @AutoItX64 Case False $tParam.strideSrc = $iW $tParam.colorTblSize -= 2 Local Const $bBinASM8_x86 = Binary("0x8B7C2404BB00000000B900000000909089C8F7670889471C89C8F7670C8947208B471C01D8034718030789C252B803000000F7E30347200347045A8B328930433B5F1076DB31DB413B4F1476C3C20400") Local $tBinASM8_x86 = DllStructCreate("ubyte asm[" & BinaryLen($bBinASM8_x86) & "]") $tBinASM8_x86.asm = $bBinASM8_x86 DllCallAddress("none", DllStructGetPtr($tBinASM8_x86), "ptr", DllStructGetPtr($tParam)) Case Else $tParam.strideSrc = $iW Local Const $bBinASM8_x64 = Binary("0x575653554989CF49836F2002BB00000000B9000000009090909090909090909089C841F767104989C289C841F767144989C34D89D04901D84D0347204D030748C7C00300000048F7E34C01D8490347084D8B08448908FFC3413B5F1876D44831DBFFC1413B4F1C76B75D5B5E5FC20800") Local $tBinASM8_x64 = _DLLStructCreate64("ubyte asm[" & BinaryLen($bBinASM8_x64) & "]") $tBinASM8_x64.asm = $bBinASM8_x64 DllCallAddress("none", DllStructGetPtr($tBinASM8_x64), "ptr", DllStructGetPtr($tParam)) EndSwitch EndIf Case 15, 16, 24, 32 ;15/16/24/32-bit, as the bitmap format is the same we can use memcpy to copy the pixel data directly to the memory. ;Exeptions are 15/16/24-bit images whose width is not a divider of 4! If BitOR($iPxDepth = 15, $iPxDepth = 16, $iPxDepth = 24) And Mod($iW, 4) Then ConsoleWrite("Using Assembler code to speed-up..." & @CRLF) Switch $iPxDepth Case 15, 16 $tParam.strideSrc = $iW * 2 Switch @AutoItX64 Case False Local Const $bBinASM1516_x86 = Binary("0x8B7C2404BB00000000B900000000909089C8F7670889471C89C8F7670C894720B802000000F7E35003471C034718030789C2580347200347048B32668930433B5F1076DC31DB413B4F1476C4C20400") Local $tBinASM1516_x86 = DllStructCreate("ubyte asm[" & BinaryLen($bBinASM1516_x86) & "]") $tBinASM1516_x86.asm = $bBinASM1516_x86 DllCallAddress("none", DllStructGetPtr($tBinASM1516_x86), "ptr", DllStructGetPtr($tParam)) Case Else Local Const $bBinASM1516_x64 = Binary("0x575653554989CFBB00000000B90000000090909090909090909090909090909089C841F767104989C189C841F767144989C25389D8D1E04C89D24801C2490357084D89C84901C04D0347204D0307498B00488902FFC3FFC3413B5F1876D55BFFC1413B4F1C76B95D5B5E5FC20800") Local $tBinASM1516_x64 = _DLLStructCreate64("ubyte asm[" & BinaryLen($bBinASM1516_x64) & "]") $tBinASM1516_x64.asm = $bBinASM1516_x64 DllCallAddress("none", DllStructGetPtr($tBinASM1516_x64), "ptr", DllStructGetPtr($tParam)) EndSwitch Case 24 $tParam.strideSrc = $iW * 3 Switch @AutoItX64 Case False Local Const $bBinASM24_x86 = Binary("0x8B7C2404BB00000000B900000000909089C8F7670889471C89C8F7670C894720B803000000F7E35003471C034718030789C2580347200347048B328930433B5F1076DD31DB413B4F1476C5C20400") Local $tBinASM24_x86 = DllStructCreate("ubyte asm[" & BinaryLen($bBinASM24_x86) & "]") $tBinASM24_x86.asm = $bBinASM24_x86 DllCallAddress("none", DllStructGetPtr($tBinASM24_x86), "ptr", DllStructGetPtr($tParam)) Case Else Local Const $bBinASM24_x64 = Binary("0x575653554989CF4831C990909090909089C841F767104989C189C841F767144989C24831DB48C7C00300000048F7E34C89D24801C2490357084D89C84901C04D0347204D0307498B00488902FFC3FFC3413B5F1876CFFFC1413B4F1C76B25D5B5E5FC20800") Local $tBinASM24_x64 = _DLLStructCreate64("ubyte asm[" & BinaryLen($bBinASM24_x64) & "]") $tBinASM24_x64.asm = $bBinASM24_x64 DllCallAddress("none", DllStructGetPtr($tBinASM24_x64), "ptr", DllStructGetPtr($tParam)) EndSwitch EndSwitch Else For $y = 0 To $iH - 1 $t1 = $y * $stride DllCall($hDLL, "ptr:cdecl", "memcpy", "ptr", DllStructGetPtr($tDestBmp) + $t1, "ptr", DllStructGetPtr($tSrcBmp) + $t1, "uint", $stride) Next EndIf EndSwitch ConsoleWrite(TimerDiff($fTimer) & " ms" & @CRLF) DllClose($hDLL) ;TGA image is stored bottom up in file. Need to flip it. If BitAND($tTGAHeader.imageDescriptor, 0x30) <> 0x20 Then _GDIPlus_ImageRotateFlip($hBitmap, $GDIP_Rotate180FlipX) $tSrcBmp = 0 Return $hBitmap EndFunc ;==>_GDIPlus_TGAImageLoadFromFile ; #INTERNAL_USE_ONLY# =========================================================================================================== ; Name ..........: RemoveNullChars ; Description ...: Converts a null terminated binary string to a string ; Author ........: UEZ ; =============================================================================================================================== Func RemoveNullChars($bin) Local $a = StringRegExp($bin, "[[:xdigit:]+]{2}", 3), $s, $i If @error Then Return $s For $i = 0 To UBound($a) - 1 If $a[$i] = "00" Then ExitLoop $s &= Chr(Dec($a[$i])) Next Return $s EndFunc ;==>RemoveNullChars ; #INTERNAL_USE_ONLY# =========================================================================================================== ; Name ..........: _DLLStructCreate64 ; Description ...: Creates a struct for x64 assembler code execution ; Author ........: AndyG ; =============================================================================================================================== Func _DLLStructCreate64($struct) ;align auf 16-byte Adresse Local $temp = DllStructCreate($struct) Local $tempsize = DllStructGetSize($temp) + 64 Local $ptr = DllStructGetPtr($struct) Local $a1 = Mod(Number($ptr), 64) Local $temp = 0 Local $mem = _MemVirtualAlloc($ptr + $a1, $tempsize, $MEM_COMMIT, $PAGE_EXECUTE_READWRITE) Local $mem_dllstructcreate64_internal = $mem Local $a2 = Mod(Number($mem), 64) ;rest div 16 adresse = offset Local $sstruct = DllStructCreate($struct, (Number($mem) - $a2 + 64)) Return $sstruct ;auf 16 alingned pointer EndFunc ;==>_DLLStructCreate64 Global $sFile = FileOpenDialog("Select a TGA file", "", "TGA image(*.tga)") If @error Then Exit _GDIPlus_Startup() Global $hImage = _GDIPlus_TGAImageLoadFromFile($sFile, True) If @error Then ConsoleWrite(@error & " / " & @extended & @CRLF) _GDIPlus_Shutdown() Exit EndIf ;save result ;~ _GDIPlus_ImageSaveToFile($hImage, @ScriptDir & "\Converted.png") ;~ ShellExecute(@ScriptDir & "\Converted.png") Global $iW = _GDIPlus_ImageGetWidth($hImage), $iH = _GDIPlus_ImageGetHeight($hImage) Global $hGui = GUICreate("TGA Image Loader by UEZ", $iW, $iH) GUISetState() Global $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGui) _GDIPlus_GraphicsDrawImageRect($hGraphics, $hImage, 0, 0, $iW, $iH) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE _GDIPlus_BitmapDispose($hImage) _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_Shutdown() Exit Case $GUI_EVENT_RESTORE _GDIPlus_GraphicsDrawImageRect($hGraphics, $hImage, 0, 0, $iW, $iH) EndSwitch WEnd Here my rookie assembler code ^^: #cs _ASM8cm_x86 use32 define tSrcBmp dword[edi] define tDestBmp dword[edi + 04] define colortable dword[edi + 08] define strideSrc dword[edi + 12] define strideDest dword[edi + 16] define w dword[edi + 20] define h dword[edi + 24] define colorTblSize dword[edi + 28] define colorwidth dword[edi + 32] define iOffset dword[edi + 36] define iOffset2 dword[edi + 40] define r5 byte[edi + 44] define g5 byte[edi + 45] define b5 byte[edi + 46] pushad ;~ _ASMDBG_() mov edi, dword[esp + 36] ;pointer to the struct xor ecx, ecx; y = 0 align 16 _y: mov eax, ecx mul strideSrc add eax, colorTblSize mov iOffset, eax ;iOffset = y * $strideSrc + $colorTblSize mov eax, ecx mul strideDest mov iOffset2, eax ;iOffset2 = y * $strideDest xor ebx, ebx ;x = 0 _x: mov eax, iOffset add eax, ebx ;iOffset + x add eax, tSrcBmp mov edx, eax ;edx = iOffset + x + tSrcBmp xor eax, eax mov al, byte[edx] ;get index from color table mul colorwidth ;multiply it with colorwidth -> eax = index of the color table mov edx, colortable add edx, eax mov esi, dword[edx] ;get the color from the color table mov eax, 3 mul ebx ; add eax, iOffset2 ; add eax, tDestBmp ;$x * 3 + iOffset2 + tDestBmp = t1 mov ebp, eax cmp colorwidth, 2 jne _col_rgb mov dx, si ;BitShift(BitAND($col, 0x001F), -3) ;B and dx, 0x001F shl dx, 3 mov b5, dl mov dx, si ;BitShift(BitShift(BitAND($col, 0x03E0), 5), -3) ;G and dx, 0x03E0 shr dx, 5 shl dx, 3 mov g5, dl mov dx, si ;BitShift(BitShift(BitAND($col, 0x7C00), 10), -3) ;R and dx, 0x7C00 shr dx, 10 shl dx, 3 mov r5, dl xor eax, eax ;eax = 0 or al, r5 ;generate rgb value from rgb555 shl eax, 8 or al, g5 shl eax, 8 or al, b5 mov esi, eax _col_rgb: mov dword[ebp], esi ;write to destination inc ebx cmp ebx, w jbe _x inc ecx cmp ecx, h jbe _y ;~ _ASMDBG_() popad ret ;4 #ce _ASM8cm_x86 #cs _ASM8cm_x64 use64 define tSrcBmp qword[r15] define tDestBmp qword[r15 + 08] define colortable qword[r15 + 16] define strideSrc dword[r15 + 24] define strideDest dword[r15 + 28] define w dword[r15 + 32] define h dword[r15 + 36] define colorTblSize dword[r15 + 40] define colorwidth dword[r15 + 44] define iOffset dword[r15 + 48] define iOffset2 dword[r15 + 52] define r5 byte[r15 + 56] define g5 byte[r15 + 57] define b5 byte[r15 + 58] define x r13d define y r14d push rdi push rsi push rbx push rbp mov qword r15, rcx mov y, 0 align 16 _y: mov eax, y mul strideSrc add eax, colorTblSize mov iOffset, eax ;iOffset = y * $strideSrc + $colorTblSize mov eax, y mul strideDest mov iOffset2, eax ;iOffset2 = y * $strideDest xor x, x ;x = 0 _x: mov eax, iOffset add eax, x ;iOffset + x add rax, tSrcBmp mov rdx, rax ;edx = iOffset + x + tSrcBmp xor rax, rax mov al, byte[rdx] ;get index from color table mul colorwidth ;multiply it with colorwidth -> eax = index of the color table mov rdx, colortable add rdx, rax mov r9d, dword[rdx] ;get the color from the color table xor rax, rax mov rax, 3 mul x ; add eax, iOffset2 ; add rax, tDestBmp ;$x * 3 + iOffset2 + tDestBmp = t1 mov r8, rax cmp colorwidth, 2 jne _col_rgb xor rdx, rdx mov dx, r9w ;BitShift(BitAND($col, 0x001F), -3) ;B and dx, 0x001F shl dx, 3 mov b5, dl xor rdx, rdx mov dx, r9w ;BitShift(BitShift(BitAND($col, 0x03E0), 5), -3) ;G and dx, 0x03E0 shr dx, 5 shl dx, 3 mov g5, dl xor rdx, rdx mov dx, r9w ;BitShift(BitShift(BitAND($col, 0x7C00), 10), -3) ;R and dx, 0x7C00 shr dx, 10 shl dx, 3 mov r5, dl xor eax, eax ;eax = 0 or al, r5 ;generate rgb value from rgb555 shl eax, 8 or al, g5 shl eax, 8 or al, b5 mov r9d, eax _col_rgb: mov dword[r8], r9d ;write to destination inc x cmp x, w jbe _x inc y cmp y, h jbe _y pop rbp pop rbx pop rsi pop rdi ret 8 #ce #cs _ASM8_x86 use32 pushad mov edi, dword[esp + 36] ;pointer to the struct define tSrcBmp dword[edi] define tDestBmp dword[edi + 04] define strideSrc dword[edi + 08] define strideDest dword[edi + 12] define w dword[edi + 16] define h dword[edi + 20] define colorTblSize dword[edi + 24] define iOffset dword[edi + 28] define iOffset2 dword[edi + 32] mov ecx, 0 ; y align 16 _y: mov eax, ecx mul strideSrc add eax, colorTblSize mov iOffset, eax ;iOffset = y * $strideSrc + $colorTblSize mov eax, ecx mul strideDest mov iOffset2, eax ;iOffset2 = y * $strideDest xor ebx, ebx ;x = 0 _x: mov ebp, iOffset sub ebp, 2 add ebp, ebx add ebp, tSrcBmp ;ebp = t1 mov eax, 3 mul ebx add eax, iOffset2 add eax, tDestBmp ;eax = t2 mov esi, dword[ebp] ;get the color from source bitmap mov dword[eax], esi ;write to destination inc ebx cmp ebx, w jbe _x inc ecx cmp ecx, h jbe _y popad ret ;4 #ce _ASM8_x86 #cs _ASM8_x64 use64 push rdi push rsi push rbx push rbp define tSrcBmp qword[r15] define tDestBmp qword[r15 + 08] define strideSrc [r15 + 16] define strideDest [r15 + 20] define w [r15 + 24] define h [r15 + 28] define colorTblSize [r15 + 32] define iOffset [r15 + 36] define iOffset2 [r15 + 40] mov qword r15, rcx sub qword colorTblSize, 2 mov ebx, 0 ;w - 1 mov ecx, 0 ;h - 1 align 16 _y: mov eax, ecx mul dword strideSrc mov r10, rax ;r10 = y * $strideSrc mov eax, ecx mul dword strideDest mov r11, rax ;r11 = y * $strideDest _x: mov r8, r10 add r8, rbx add r8, colorTblSize add r8, tSrcBmp ;r8 = t1 mov rax, 3 mul rbx add rax, r11 add rax, tDestBmp ;eax = t2 mov r9, [r8] ;get the color from source bitmap mov dword[rax], r9d ;write to destination inc ebx cmp ebx, w jbe _x xor rbx, rbx inc ecx cmp ecx, h jbe _y pop rbp pop rbx pop rsi pop rdi ret 8 #ce _ASM8_x64 #cs _ASM1516_x86 use32 mov edi, dword[esp + 4] ;pointer to the struct define tSrcBmp ptr[edi] define tDestBmp ptr[edi + 04] define strideSrc dword[edi + 08] define strideDest dword[edi + 12] define w dword[edi + 16] define h dword[edi + 20] define colorTblSize dword[edi + 24] define iOffset dword[edi + 28] define iOffset2 dword[edi + 32] mov ebx, 0 ; x mov ecx, 0 ; y align 16 _y: mov eax, ecx mul strideSrc mov iOffset, eax ;iOffset = y * $strideSrc mov eax, ecx mul strideDest mov iOffset2, eax ;iOffset2 = y * $strideDest _x: mov eax, 2 mul ebx ;x * 2 push eax add eax, iOffset add eax, colorTblSize add eax, tSrcBmp mov edx, eax ;edx = t1 pop eax ;restore x * 2 add eax, iOffset2 add eax, tDestBmp ;eax = t2 mov esi, dword[edx] ;get the color from source bitmap mov word[eax], si ;write to destination inc ebx cmp ebx, w jbe _x xor ebx, ebx inc ecx cmp ecx, h jbe _y ret ;4 #ce _ASM1516_x86 #cs _ASM1516_x64 use64 ;~ define tSrcBmp dword[r15 + 0] ;~ define tDestBmp dword[r15 + 8] ;~ define strideS dword[r15 + 16] ;~ define strideD dword[r15 + 20] ;~ define width dword[r15 + 24] ;~ define height dword[r15 + 28] ;~ define colorTblSize dword[r15 + 32] ;~ define t1 dword[r15 + 36] ;not needed ;~ define t2 dword[r15 + 40] ;not needed push rdi push rsi push rbx push rbp mov qword r15, rcx mov ebx, 0 ;dword[r15 + 24] ;ebx = w - 1 mov ecx, 0 ;dword[r15 + 28] ;ecx = h - 1 align 16 _y: mov eax, ecx mul dword[r15 + 16] mov r9, rax mov eax, ecx mul dword[r15 + 20] mov r10, rax push rbx _x: mov eax, ebx shl eax, 1 mov rdx, r10 add rdx, rax add rdx, [r15 + 8] mov r8, r9 add r8, rax add r8, [r15 + 32] add r8, [r15] mov rax, [r8] mov [rdx], rax inc ebx inc ebx cmp ebx, dword[r15 + 24] jbe _x pop rbx inc ecx cmp ecx, dword[r15 + 28] jbe _y pop rbp pop rbx pop rsi pop rdi ret 8 #ce _ASM1516_x64 #cs _ASM24_x86 use32 mov edi, dword[esp + 4] ;pointer to the struct define tSrcBmp dword[edi] define tDestBmp dword[edi + 04] define strideSrc dword[edi + 08] define strideDest dword[edi + 12] define w dword[edi + 16] define h dword[edi + 20] define colorTblSize dword[edi + 24] define iOffset dword[edi + 28] define iOffset2 dword[edi + 32] mov ebx, 0 ; x mov ecx, 0 ; y align 16 _y: mov eax, ecx mul strideSrc mov iOffset, eax ;iOffset = y * $strideSrc mov eax, ecx mul strideDest mov iOffset2, eax ;iOffset2 = y * $strideDest _x: mov eax, 3 mul ebx ;x * 3 push eax add eax, iOffset add eax, colorTblSize add eax, tSrcBmp mov edx, eax ;edx = t1 pop eax ;restore x * 3 add eax, iOffset2 add eax, tDestBmp ;eax = t2 mov esi, dword[edx] ;get the color from source bitmap mov dword[eax], esi ;write to destination inc ebx cmp ebx, w jbe _x xor ebx, ebx inc ecx cmp ecx, h jbe _y ret ;4 #ce _ASM24_x86 #cs _ASM24_x64 use64 ;~ define tSrcBmp dword[r15 + 0] ;~ define tDestBmp dword[r15 + 8] ;~ define strideS dword[r15 + 16] ;~ define strideD dword[r15 + 20] ;~ define width dword[r15 + 24] ;~ define height dword[r15 + 28] ;~ define colorTblSize dword[r15 + 32] ;~ define t1 dword[r15 + 36] ;not needed ;~ define t2 dword[r15 + 40] ;not needed push rdi push rsi push rbx push rbp mov qword r15, rcx xor rcx, rcx align 16 _y: mov eax, ecx mul dword[r15 + 16] mov r9, rax mov eax, ecx mul dword[r15 + 20] mov r10, rax xor rbx, rbx _x: mov rax, 3 mul rbx mov rdx, r10 add rdx, rax add rdx, [r15 + 8] mov r8, r9 add r8, rax add r8, [r15 + 32] add r8, [r15] mov rax, [r8] mov [rdx], rax ;copy 64 bits inc ebx inc ebx cmp ebx, dword[r15 + 24] jbe _x inc ecx cmp ecx, dword[r15 + 28] jbe _y pop rbp pop rbx pop rsi pop rdi ret 8 #ce _ASM24_x64 If you find a TGA image which is in scope of this script but doesn't convert it properly, please report it here. Thanks.
-
Hi! I am writing some GUI and i need to use images as buttons, but with text on them (text is from INI file). Part with button looks like this: $ankieta1 = GUICtrlCreateButton($txtAnk1, 100,350,765,164) GUICtrlSetFont(-1, 22, 800, -1, "Arial") ;GUICtrlSetColor(-1,0xffffff) $hImageBtn_1 = _GUIImageList_Create(765, 164) _GUIImageList_AddBitmap($hImageBtn_1, "c:\path\to\ankieta_clean.bmp") _GUICtrlButton_SetImageList($ankieta1, $hImageBtn_1, 4) GUICtrlSetOnEvent(-1, "On_Ankieta1") The problem - if i uncomment GUICtrlSetColor, color of text changes, but button is just plain gray (no image). How i can change text color not touching image on a button here?
-
Happy New Year everyone! I would like to extract the color values of certain pixels in an image. This is how I picture the workflow: User opens an image of his choice. Image is shown on the screen. User draws a line into the image. This happens by marking the startpixel and the endpixel of the line The line is drawn, so the user can check visually if he is happy with the line. The following pixel based properties belonging to the line are stored in Excel: X-Coordinate Y-Coordinate Color Value Additional operations: Extracting for max- and min. color values; Statistical operations. Browsing through the helpfile of AutoIt I find plenty of functions for treating images (e.g. GDIPlus), but I am completely unsure if Autoit will get me there. Should I read the entire image into an array? Should I rather attempt to script an external image software (e.g. IrfanView, Gimp)? I would be very thankful if someone could give some recommendations and maybe list a couple of the most important commands to use. Thank you very much. Dejhost
-
hello Im wondering if it is possible to process image in autoit like this 1. firstly there is colorfull wallpaper 2. Fill all colors (exception rose color) - with white 3. Fill rose color with black color I see Gdi functions have things to manipulate images https://imgur.com/a/lFdY26g
-
Here a little tool to display the histogram of an image (inspired by this thread): ) ;#AutoIt3Wrapper_Icon=Histogram1.ico #AutoIt3Wrapper_Compile_Both=y ;#AutoIt3Wrapper_Res_Field=CompanyName|UEZ Software Development ;#AutoIt3Wrapper_Res_Field=ProductName|GDI+ Show Histogram ;#AutoIt3Wrapper_Res_Field=ProductVersion|%AutoItVer% #AutoIt3Wrapper_Res_Fileversion=0.9.8.0 ;#AutoIt3Wrapper_Res_Field=Build|2015-07-10 #AutoIt3Wrapper_Res_LegalCopyright=UEZ Software Development #AutoIt3Wrapper_Res_Language=1033 ;#AutoIt3Wrapper_Res_Field=URL|http://www.autoitscript.com/forum/index.php?showtopic=147777 #AutoIt3Wrapper_Run_Au3Stripper=y #Au3Stripper_Parameters=/so /pe /rm #AutoIt3Wrapper_Run_After=del /f /q "%scriptdir%\%scriptfile%_stripped.au3" #AutoIt3Wrapper_UseUpx=y #AutoIt3Wrapper_UPX_Parameters=--best --lzma #AutoIt3Wrapper_Run_After=upx.exe --best --lzma "GDI+ Show Histogram_x64.exe" #AutoIt3Wrapper_UseX64=n #include <Constants.au3> #include <GUIConstantsEx.au3> #include <GDIPlus.au3> #include <WindowsConstants.au3> Opt("MustDeclareVars", 1) Opt("MouseCoordMode", 2) _GDIPlus_Startup() If @error Then Exit MsgBox(0x40010, "Error", "GDI+ Show Histogram can run on operating systems Vista or newer only!") Global $ghGDIPDll = $__g_hGDIPDll, $aRes Global Const $hFullScreen = WinGetHandle("[TITLE:Program Manager;CLASS:Progman]") Global Const $aFullScreen = WinGetPos($hFullScreen) Global Enum $HistogramFormatARGB, $HistogramFormatPARGB, $HistogramFormatRGB, $HistogramFormatGray, _ ;http://msdn.microsoft.com/en-us/library/windows/desktop/ms534129(v=vs.85).aspx $HistogramFormatB, $HistogramFormatG, $HistogramFormatR, $HistogramFormatA Global $tStructChannel0 = DllStructCreate("uint channel0[256]") Global $pStructChannel0 = DllStructGetPtr($tStructChannel0) Global $tStructChannel1 = DllStructCreate("uint channel1[256]") Global $pStructChannel1 = DllStructGetPtr($tStructChannel1) Global $tStructChannel2 = DllStructCreate("uint channel2[256]") Global $pStructChannel2 = DllStructGetPtr($tStructChannel2) Global $tStructChannel3 = DllStructCreate("uint channel3[256]") Global $pStructChannel3 = DllStructGetPtr($tStructChannel3) Global $s, $sFile, $hImage, $bImgLoaded = False, $aLuminosity[257], $aCRGB[257] Global Const $STM_SETIMAGE = 0x0172, $iLineJoinBevel = 1, $frY = 0.299, $fgY = 0.587, $fbY = 0.114 Global Const $hGUI = GUICreate("GDI+ Show Histogram v0.98 beta by UEZ build 2015-07-13", 468, 310, -1, -1, Default, Default) GUISetBkColor(0xFFFFFF, $hGUI) Global Const $sLabel_Titel_Txt = "GDI+ Show Histogram" Global Const $iPosX_Label = 20, $iPosY_Label = 12 Global Const $iLabel_Titel_Shadow = GUICtrlCreateLabel($sLabel_Titel_Txt, $iPosX_Label, $iPosY_Label, 429, 57) GUICtrlSetFont(-1, 30, 400, 0, "Comic Sans MS", 4) GUICtrlSetColor(-1, 0xC0C0D8) Global Const $iLabel_Titel = GUICtrlCreateLabel($sLabel_Titel_Txt, $iPosX_Label - 4, $iPosY_Label - 4, 429, 57) GUICtrlSetFont(-1, 30, 400, 0, "Comic Sans MS", 4) GUICtrlSetColor(-1, 0x0000C0) GUICtrlSetBkColor(-1, -2) Global Const $iPic_Histogram = GUICtrlCreatePic("", 20, 90, 255, 127, -1, $WS_EX_STATICEDGE) GUICtrlSetCursor(-1, 14) Global Const $iPic_ColorGradient = GUICtrlCreatePic("", 20, 220, 255, 24, -1, $WS_EX_STATICEDGE) Global Const $iGroup = GUICtrlCreateGroup("Channel", 290, 84, 160, 164) Global Const $iRadio_L = GUICtrlCreateRadio("Luminosit&y (gray)", 300, 100, 110, 20) GUICtrlSetTip(-1, $frY & "*R, " & $fgY & "*G, " & $fbY & "*B") GUICtrlSetState($iRadio_L, $GUI_CHECKED) Global Const $iRadio_C = GUICtrlCreateRadio("&cRGB", 300, 130, 60, 20) GUICtrlSetTip(-1, "Combined average of RGB values") Global Const $iRadio_R = GUICtrlCreateRadio("&Red", 300, 160, 60, 20) Global Const $iRadio_G = GUICtrlCreateRadio("&Green", 300, 190, 60, 20) Global Const $iRadio_B = GUICtrlCreateRadio("&Blue", 300, 220, 60, 20) GUICtrlCreateGroup("", -99, -99, 1, 1) Global Const $iButton_Save = GUICtrlCreateButton("&Save", 209, 265, 70, 30) GUICtrlSetTip(-1, "Click button to save all histogram images") GUICtrlSetState(-1, $GUI_DISABLE) Global Const $iButton_Load = GUICtrlCreateButton("&Load", 290, 265, 70, 30) GUICtrlSetTip(-1, "Click button to load an image") Global Const $iButton_Exit = GUICtrlCreateButton("E&xit", 390, 265, 60, 30) Global $sLabelCredit_Txt = "coded by UEZ'13" Global $aLabelCredit_Pos[StringLen($sLabelCredit_Txt)][4], $u, $iFS = 6.5, $iY = 280 For $u = 0 To UBound($aLabelCredit_Pos) - 1 $aLabelCredit_Pos[$u][0] = StringMid($sLabelCredit_Txt, $u + 1, 1) $aLabelCredit_Pos[$u][1] = 20 + $u * ($iFS - 0.25) $aLabelCredit_Pos[$u][2] = $iY $aLabelCredit_Pos[$u][3] = GUICtrlCreateLabel($aLabelCredit_Pos[$u][0], $aLabelCredit_Pos[$u][1], $aLabelCredit_Pos[$u][2], $iFS, $iFS * 1.8) GUICtrlSetFont(-1, $iFS, 400, 0, "Comic Sans MS", 2) GUICtrlSetColor(-1, 0x006000) Next Global $aLabelCredit_AnimPos[300] For $u = 0 To UBound($aLabelCredit_AnimPos) - 1 $aLabelCredit_AnimPos[$u] = $iY Next Global Const $fLimes = 2.2, $fStep = 0.1 Global $iPT = 0, $z = Int((UBound($aLabelCredit_AnimPos) - ($fLimes * $fStep * 100)) / 2) For $u = 0 To $fLimes Step $fStep $aLabelCredit_AnimPos[$z] = $iY + Sin($iPT * 4) * 10 $z += 1 $iPT += 0.075 Next Global $ihGui_PreviewSize = 256, $iBGColor = 0xF0F0F0 Global $hGui_Preview = GUICreate("", $ihGui_PreviewSize, $ihGui_PreviewSize + 58, -1, -1, $WS_POPUP + $WS_BORDER, $WS_EX_TOPMOST, $hGUI) Global $iPic_Preview = GUICtrlCreatePic("", 0, 0, $ihGui_PreviewSize, $ihGui_PreviewSize) Global $idLabel_Info = GUICtrlCreateLabel("", 0, $ihGui_PreviewSize, $ihGui_PreviewSize * 2, 58) GUICtrlSetFont(-1, 8.5, 400, 0, "Arial", 5) GUICtrlSetColor(-1, $iBGColor) GUICtrlSetBkColor(-1, 0x333333) Global Const $hTexture_Checkerboard = _GDIPlus_CreateCheckerboardTexture(8, 0xFFFBFBFB, 0xFFFFFFFF) Global $hHBmp_L = _GDIPlus_CreateColorGradient("L", 256, 24) Global $hHBmp_C = _GDIPlus_CreateColorGradient("C", 256, 24) Global $hHBmp_R = _GDIPlus_CreateColorGradient("R", 256, 24) Global $hHBmp_G = _GDIPlus_CreateColorGradient("G", 256, 24) Global $hHBmp_B = _GDIPlus_CreateColorGradient("B", 256, 24) Global Const $hHBmp_HL = _GDIPlus_BitmapCreateFromScan0(256, 127) Global Const $hCtxt_HL = _GDIPlus_ImageGetGraphicsContext($hHBmp_HL) Global Const $hHBmp_HC = _GDIPlus_BitmapCloneArea($hHBmp_HL, 0, 0, 256, 127, 0x0026200A) Global Const $hCtxt_HC = _GDIPlus_ImageGetGraphicsContext($hHBmp_HC) Global Const $hHBmp_HR = _GDIPlus_BitmapCloneArea($hHBmp_HL, 0, 0, 256, 127, 0x0026200A) Global Const $hCtxt_HR = _GDIPlus_ImageGetGraphicsContext($hHBmp_HR) Global Const $hHBmp_HG = _GDIPlus_BitmapCloneArea($hHBmp_HL, 0, 0, 256, 127, 0x0026200A) Global Const $hCtxt_HG = _GDIPlus_ImageGetGraphicsContext($hHBmp_HG) Global Const $hHBmp_HB = _GDIPlus_BitmapCloneArea($hHBmp_HL, 0, 0, 256, 127, 0x0026200A) Global Const $hCtxt_HB = _GDIPlus_ImageGetGraphicsContext($hHBmp_HB) _GDIPlus_GraphicsClear($hCtxt_HL, 0xFFFFFFFF) _hBmpToPicControl($iPic_ColorGradient, $hHBmp_L) Global $hB_H = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hHBmp_HL) _hBmpToPicControl($iPic_Histogram, $hB_H, 1) GUISetState(@SW_HIDE, $hGui_Preview) GUISetState(@SW_SHOW, $hGUI) ControlFocus($hGUI, "", $iButton_Load) Global $hPen_H = _GDIPlus_PenCreate() $s = "L" Global $iDummyL = GUICtrlCreateDummy(), $iDummyC = GUICtrlCreateDummy(), $iDummyR = GUICtrlCreateDummy(), $iDummyG = GUICtrlCreateDummy(), $iDummyB = GUICtrlCreateDummy() Global $iHistogramFormat, $hHBmp_Preview, $aPosCtrl, $aPosWin, $aMouseInfo, $aPos_hWnd, $imp, $iVal, $iMpos_oldx, $iMpos_oldy, $sType, $iPaletteType, $iPixelFormat Global $fAverage_L, $fAverage_cRGB, $iAverage_R, $iAverage_B, $iAverage_G, $o = 0 Global $bShow = False, $bHide = False, $bIsAlpha = False, $bIsGray = False Global Const $iEntries = 256 Global Const $tagCOLORPALETTE = "uint Flags;" & _ ; Palette flags "uint Count;" & _ ; Number of color entries "uint ARGB[" & $iEntries & "];" ; Palette color AdlibRegister("AnimateLabel", 60) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $iButton_Exit AdlibUnRegister("AnimateLabel") GUIDelete($hGui_Preview) GUIDelete($hGUI) _WinAPI_DeleteObject($hHBmp_L) _WinAPI_DeleteObject($hHBmp_C) _WinAPI_DeleteObject($hHBmp_L) _WinAPI_DeleteObject($hHBmp_R) _WinAPI_DeleteObject($hHBmp_G) _WinAPI_DeleteObject($hHBmp_B) If $hHBmp_Preview Then _WinAPI_DeleteObject($hHBmp_Preview) _GDIPlus_PenDispose($hPen_H) _GDIPlus_BrushDispose($hTexture_Checkerboard) _GDIPlus_GraphicsDispose($hCtxt_HL) _GDIPlus_GraphicsDispose($hCtxt_HC) _GDIPlus_GraphicsDispose($hCtxt_HR) _GDIPlus_GraphicsDispose($hCtxt_HG) _GDIPlus_GraphicsDispose($hCtxt_HB) _GDIPlus_BitmapDispose($hHBmp_HL) _GDIPlus_BitmapDispose($hHBmp_HC) _GDIPlus_BitmapDispose($hHBmp_HR) _GDIPlus_BitmapDispose($hHBmp_HG) _GDIPlus_BitmapDispose($hHBmp_HB) _GDIPlus_Shutdown() $tStructChannel0 = 0 $tStructChannel1 = 0 $tStructChannel2 = 0 $tStructChannel3 = 0 Exit Case $iRadio_L, $iDummyL If $s <> "L" Then _hBmpToPicControl($iPic_ColorGradient, $hHBmp_L) If $bImgLoaded Then $hB_H = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hHBmp_HL) _hBmpToPicControl($iPic_Histogram, $hB_H, 1) EndIf $s = "L" EndIf Case $iRadio_C, $iDummyC If $s <> "C" Then _hBmpToPicControl($iPic_ColorGradient, $hHBmp_C) If $bImgLoaded Then $hB_H = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hHBmp_HC) _hBmpToPicControl($iPic_Histogram, $hB_H, 1) EndIf $s = "C" EndIf Case $iRadio_R, $iDummyR If $s <> "R" Then _hBmpToPicControl($iPic_ColorGradient, $hHBmp_R) If $bImgLoaded Then $hB_H = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hHBmp_HR) _hBmpToPicControl($iPic_Histogram, $hB_H, 1) EndIf $s = "R" EndIf Case $iRadio_G, $iDummyG If $s <> "G" Then _hBmpToPicControl($iPic_ColorGradient, $hHBmp_G) If $bImgLoaded Then $hB_H = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hHBmp_HG) _hBmpToPicControl($iPic_Histogram, $hB_H, 1) EndIf $s = "G" EndIf Case $iRadio_B, $iDummyB If $s <> "B" Then _hBmpToPicControl($iPic_ColorGradient, $hHBmp_B) If $bImgLoaded Then $hB_H = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hHBmp_HB) _hBmpToPicControl($iPic_Histogram, $hB_H, 1) EndIf $s = "B" EndIf Case $iButton_Load $sFile = FileOpenDialog("Select an image", "", "Images (*.jpg;*.png;*.bmp;*.gif)", 3) If @error Then ContinueCase If $bImgLoaded Then _GDIPlus_ImageDispose($hImage) $hImage = _GDIPlus_ImageLoadFromFile($sFile) If @error Then MsgBox(0x40010, "Error", "Unable to load image", 30) ContinueCase EndIf GUICtrlSetState($iButton_Save, $GUI_ENABLE) $aRes = _GDIPlus_ImageGetFlags($hImage) If BitAND($aRes[0], $GDIP_IMAGEFLAGS_HASALPHA) Then $bIsAlpha = True Else $bIsAlpha = False EndIf If BitAND($aRes[0], $GDIP_IMAGEFLAGS_COLORSPACE_GRAY) Then $bIsGray = True Else $bIsGray = False EndIf $hHBmp_Preview = _GetImage($sFile, $ihGui_PreviewSize, $iBGColor) _hBmpToPicControl($iPic_Preview, $hHBmp_Preview, 1) If Not $bIsAlpha Then $pStructChannel3 = 0 $iHistogramFormat = $HistogramFormatRGB Else $pStructChannel3 = DllStructGetPtr($tStructChannel3) $iHistogramFormat = $HistogramFormatARGB EndIf _GDIPlus_BitmapGetHistogram($hImage, $iHistogramFormat, _GDIPlus_BitmapGetHistogramSize($iHistogramFormat), $pStructChannel0, $pStructChannel1, $pStructChannel2, $pStructChannel3) _GDIPlus_CreateHistogram() $bImgLoaded = True If BitAND(GUICtrlRead($iRadio_L), $GUI_CHECKED) Then $s = "" GUICtrlSendToDummy($iDummyL) ElseIf BitAND(GUICtrlRead($iRadio_C), $GUI_CHECKED) Then $s = "" GUICtrlSendToDummy($iDummyC) ElseIf BitAND(GUICtrlRead($iRadio_R), $GUI_CHECKED) Then $s = "" GUICtrlSendToDummy($iDummyR) ElseIf BitAND(GUICtrlRead($iRadio_G), $GUI_CHECKED) Then $s = "" GUICtrlSendToDummy($iDummyG) Else $s = "" GUICtrlSendToDummy($iDummyB) EndIf Case $iButton_Save If $sFile = "" Then ContinueLoop $sType = "png" $o += _GDIPlus_ImageSaveToFile($hHBmp_HL, StringRegExpReplace($sFile, "(.*)\..*", "$1") & "_Luminosity." & $sType) $o += _GDIPlus_ImageSaveToFile($hHBmp_HC, StringRegExpReplace($sFile, "(.*)\..*", "$1") & "_cRGB." & $sType) $o += _GDIPlus_ImageSaveToFile($hHBmp_HR, StringRegExpReplace($sFile, "(.*)\..*", "$1") & "_Red." & $sType) $o += _GDIPlus_ImageSaveToFile($hHBmp_HG, StringRegExpReplace($sFile, "(.*)\..*", "$1") & "_Green." & $sType) $o += _GDIPlus_ImageSaveToFile($hHBmp_HB, StringRegExpReplace($sFile, "(.*)\..*", "$1") & "_Blue." & $sType) If $o = 5 Then MsgBox(64 + 262144, "Information", "Images properly saved to " & StringRegExpReplace($sFile, "(.*)\\.*", "$1"), 30, $hGUI) Else MsgBox(16 + 262144, "Error", "One or more images could not saved to " & StringRegExpReplace($sFile, "(.*)\\.*", "$1") & ".", 30, $hGUI) EndIf EndSwitch If WinActive($hGUI) Then $aMouseInfo = GUIGetCursorInfo($hGUI) Switch $aMouseInfo[4] Case $iPic_Histogram If $bImgLoaded Then $aPos_hWnd = WinGetPos($hGUI) $imp = Max(1, Min(256, -19 + $aMouseInfo[0])) Switch $s Case "L" $iVal = $aLuminosity[$imp] Case "C" $iVal = $aCRGB[$imp] Case "R" $iVal = DllStructGetData($tStructChannel0, "channel0", $imp) Case "G" $iVal = DllStructGetData($tStructChannel1, "channel1", $imp) Case "B" $iVal = DllStructGetData($tStructChannel2, "channel2", $imp) EndSwitch If $iMpos_oldx <> $aMouseInfo[0] Or $iMpos_oldy <> $aMouseInfo[1] Then ToolTip("Index: " & $imp & ", Value: " & Round($iVal, 0) & ", Average: " & Round($fAverage_L, 2), $aPos_hWnd[0] + $aMouseInfo[0] - 60, $aMouseInfo[1] + $aPos_hWnd[1] - 20) $iMpos_oldx = $aMouseInfo[0] $iMpos_oldy = $aMouseInfo[1] EndIf ShowPreview($iPic_Histogram) $bShow = True $bHide = False EndIf Case Else If Not $bHide Then GUISetState(@SW_HIDE, $hGui_Preview) $bHide = True ToolTip("") EndIf $bShow = False EndSwitch EndIf WEnd Func AnimateLabel() Local Static $v = Int((UBound($aLabelCredit_AnimPos) - ($fLimes * $fStep * 100)) / 2) Local $u For $u = 0 To UBound($aLabelCredit_Pos) - 1 GUICtrlSetPos($aLabelCredit_Pos[$u][3], $aLabelCredit_Pos[$u][1], $aLabelCredit_AnimPos[$v - $u]) Next If $v - $u < 0 Then $v = UBound($aLabelCredit_AnimPos) - 1 $v -= 1 EndFunc ;==>AnimateLabel Func Min($a, $b) If $a < $b Then Return $a Return $b EndFunc ;==>Min Func Max($a, $b) If $a > $b Then Return $a Return $b EndFunc ;==>Max Func ShowPreview($iCtrl) $aPosWin = WinGetPos($hGUI) $aPosCtrl = ControlGetPos($hGUI, "", $iCtrl) Local $iNewX, $iNewX1 = $aPosWin[0] - $ihGui_PreviewSize + 10, $iNewX2 = $aPosWin[0] + $aPosWin[2] - 10 $iNewX = $iNewX1 If $iNewX1 < $aFullScreen[0] Then $iNewX = $iNewX2 EndIf WinMove($hGui_Preview, "", $iNewX, $aPosWin[1] + 50) GUISetState(@SW_SHOWNOACTIVATE, $hGui_Preview) EndFunc ;==>ShowPreview Func _GetImage($sFile, $iWH, $iBkClr = 0xFFFFFF, $bCheckerboard_Bg = True) Local $hBmp1, $hBitmap, $hGraphic, $hImage, $iW, $iH, $aGS, $hBmp2, $aFTS $aFTS = FileGetTime($sFile) If @error Then Return SetError(1, 0, 0) $hBmp1 = _WinAPI_CreateBitmap($iWH, $iWH, 1, 32) $hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hBmp1) $hGraphic = _GDIPlus_ImageGetGraphicsContext($hBitmap) _WinAPI_DeleteObject($hBmp1) $hImage = _GDIPlus_ImageLoadFromFile($sFile) $iW = _GDIPlus_ImageGetWidth($hImage) $iH = _GDIPlus_ImageGetHeight($hImage) GUICtrlSetData($idLabel_Info, StringRegExpReplace($sFile, ".*\\(.*)", "$1") & @LF & Round(FileGetSize($sFile) / 1024, 0) & " kb (" & $iW & " x " & $iH & ")" & @LF & $aFTS[0] & "/" & $aFTS[1] & "/" & $aFTS[2] & " " & $aFTS[3] & ":" & $aFTS[4] & ":" & $aFTS[5] & @LF & "Alpha: " & $bIsAlpha & ", Gray: " & $bIsGray) $aGS = _GetScale($iW, $iH, $iWH) Switch $bCheckerboard_Bg Case True ;~ _GDIPlus_GraphicsFillRect($hGraphic, 0, 0, $iWH, $iWH, $hTexture_Checkerboard) _GDIPlus_GraphicsClear($hGraphic, BitOR(0xFF000000, $iBkClr)) _GDIPlus_GraphicsFillRect($hGraphic, $aGS[0], $aGS[1], $aGS[2], $aGS[3], $hTexture_Checkerboard) Case False _GDIPlus_GraphicsClear($hGraphic, BitOR(0xFF000000, $iBkClr)) EndSwitch _GDIPlus_GraphicsDrawImageRect($hGraphic, $hImage, $aGS[0], $aGS[1], $aGS[2], $aGS[3]) _GDIPlus_ImageDispose($hImage) _GDIPlus_GraphicsDispose($hGraphic) $hBmp2 = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap) _GDIPlus_BitmapDispose($hBitmap) Return $hBmp2 EndFunc ;==>_GetImage Func _GetScale($iW, $iH, $iWH) Local $aRet[4] If $iW <= $iWH And $iH <= $iWH Then $aRet[2] = $iW $aRet[3] = $iH $aRet[0] = ($iWH - $aRet[2]) / 2 $aRet[1] = ($iWH - $aRet[3]) / 2 ElseIf $iW > $iH Then $aRet[2] = $iWH $aRet[3] = $iH / ($iW / $iWH) $aRet[0] = 0 $aRet[1] = ($iWH - $aRet[3]) / 2 ElseIf $iW < $iH Then $aRet[2] = $iW / ($iH / $iWH) $aRet[3] = $iWH $aRet[0] = ($iWH - $aRet[2]) / 2 $aRet[1] = 0 ElseIf $iW = $iH Then $aRet[2] = $iWH $aRet[3] = $iWH $aRet[0] = 0 $aRet[1] = 0 EndIf Return $aRet EndFunc ;==>_GetScale Func _hBmpToPicControl($iCID, ByRef $hBmp, $iFlag = 0) Local $hOldBmp $hOldBmp = GUICtrlSendMsg($iCID, $STM_SETIMAGE, $IMAGE_BITMAP, $hBmp) If $hOldBmp Then _WinAPI_DeleteObject($hOldBmp) If $iFlag Then _WinAPI_DeleteObject($hBmp) EndFunc ;==>_hBmpToPicControl Func _GDIPlus_CreateHistogram($sRounding = "Ceiling") Local $iMaxL, $iMaxC, $iMaxR, $iMaxG, $iMaxB, $a, $r, $g, $b, $yR, $yG, $yB, $iRedAv, $iGreenAv, $iBlueAv For $i = 1 + $bIsAlpha To 256 If $bIsAlpha Then ;~ ConsoleWrite("Alpha: " & DllStructGetData($tStructChannel0, "channel0", $i) & @CRLF) $r = DllStructGetData($tStructChannel1, "channel1", $i) $yR = $r * $frY If DllStructGetData($tStructChannel1 , "channel1", $i) > $iMaxR Then $iMaxR = $r $g = DllStructGetData($tStructChannel2, "channel2", $i) $yG = $g * $fgY If DllStructGetData($tStructChannel2 , "channel2", $i) > $iMaxG Then $iMaxG = $g $b = DllStructGetData($tStructChannel3, "channel3", $i) $yB = $b * $fbY If DllStructGetData($tStructChannel3 , "channel3", $i) > $iMaxB Then $iMaxB = $b $fAverage_cRGB += $r + $g + $b $fAverage_L += $yR + $yG + $yB Else $r = DllStructGetData($tStructChannel0, "channel0", $i) $yR = $r * $frY If DllStructGetData($tStructChannel0 , "channel0", $i) > $iMaxR Then $iMaxR = $r $g = DllStructGetData($tStructChannel1, "channel1", $i) $yG = $g * $fgY If DllStructGetData($tStructChannel1 , "channel1", $i) > $iMaxG Then $iMaxG = $g $b = DllStructGetData($tStructChannel2, "channel2", $i) $yB = $b * $fbY If DllStructGetData($tStructChannel2 , "channel2", $i) > $iMaxB Then $iMaxB = $b EndIf $fAverage_cRGB += $r + $g + $b $fAverage_L += $yR + $yG + $yB $aLuminosity[$i] = $yR + $yG + $yB If $aLuminosity[$i] > $iMaxL Then $iMaxL = $aLuminosity[$i] $aCRGB[$i] = ($r + $g + $b) / 3 If $aCRGB[$i] > $iMaxC Then $iMaxC = $aCRGB[$i] Next $fAverage_cRGB /= 256 * 3 $fAverage_L /= 256 _GDIPlus_GraphicsClear($hCtxt_HL, 0xFFFFFFFF) _GDIPlus_GraphicsClear($hCtxt_HC, 0xFFFFFFFF) _GDIPlus_GraphicsClear($hCtxt_HR, 0xFFFFFFFF) _GDIPlus_GraphicsClear($hCtxt_HG, 0xFFFFFFFF) _GDIPlus_GraphicsClear($hCtxt_HB, 0xFFFFFFFF) Local $iDL = 1, $iDC = 1, $iDR = 1, $iDG = 1, $iDB = 1 Local $sRoundings = "Round,Ceiling,Floor," If Not StringInStr($sRoundings, $sRounding) Then $sRounding = "Ceiling" If $iMaxL > 128 Then ;~ $iDL = Ceiling($iMaxL / 128) $iDL = Execute($sRounding & "(" & $iMaxL / 128 & ")") Else $iDL = 1 / (128 / $iMaxL) EndIf If $iMaxC > 128 Then ;~ $iDC = Ceiling($iMaxC / 128) $iDC = Execute($sRounding & "(" & $iMaxC / 128 & ")") Else $iDC = 1 / (128 / $iMaxC) EndIf If $iMaxR > 128 Then ;~ $iDR = Ceiling($iMaxR / 128) $iDR = Execute($sRounding & "(" & $iMaxR / 128 & ")") Else $iDR = 1 / (128 / $iMaxR) EndIf If $iMaxG > 128 Then ;~ $iDG = Ceiling($iMaxG / 128) $iDG = Execute($sRounding & "(" & $iMaxG / 128 & ")") Else $iDG = 1 / (128 / $iMaxG) EndIf If $iMaxB > 128 Then ;~ $iDB = Ceiling($iMaxB / 128) $iDB = Execute($sRounding & "(" & $iMaxB / 128 & ")") Else $iDB = 1 / (128 / $iMaxB) EndIf For $i = 1 To 256 _GDIPlus_PenSetColor($hPen_H, 0xFF000000) _GDIPlus_GraphicsDrawLine($hCtxt_HL, $i - 1, 127, $i - 1, 127 - (Int($aLuminosity[$i] / $iDL)), $hPen_H) _GDIPlus_PenSetColor($hPen_H, 0xFF000000) _GDIPlus_GraphicsDrawLine($hCtxt_HC, $i - 1, 127, $i - 1, 127 - (Int($aCRGB[$i] / $iDC)), $hPen_H) _GDIPlus_PenSetColor($hPen_H, 0xFFB00000) If $bIsAlpha Then _GDIPlus_GraphicsDrawLine($hCtxt_HR, $i - 1, 127, $i - 1, 127 - (Int(DllStructGetData($tStructChannel1, "channel1", $i) / $iDR)), $hPen_H) _GDIPlus_PenSetColor($hPen_H, 0xFF00B000) _GDIPlus_GraphicsDrawLine($hCtxt_HG, $i - 1, 127, $i - 1, 127 - (Int(DllStructGetData($tStructChannel2, "channel2", $i) / $iDG)), $hPen_H) _GDIPlus_PenSetColor($hPen_H, 0xFF0000B0) _GDIPlus_GraphicsDrawLine($hCtxt_HB, $i - 1, 127, $i - 1, 127 - (Int(DllStructGetData($tStructChannel3, "channel3", $i) / $iDB)), $hPen_H) Else _GDIPlus_GraphicsDrawLine($hCtxt_HR, $i - 1, 127, $i - 1, 127 - (Int(DllStructGetData($tStructChannel0, "channel0", $i) / $iDR)), $hPen_H) _GDIPlus_PenSetColor($hPen_H, 0xFF00B000) _GDIPlus_GraphicsDrawLine($hCtxt_HG, $i - 1, 127, $i - 1, 127 - (Int(DllStructGetData($tStructChannel1, "channel1", $i) / $iDG)), $hPen_H) _GDIPlus_PenSetColor($hPen_H, 0xFF0000B0) _GDIPlus_GraphicsDrawLine($hCtxt_HB, $i - 1, 127, $i - 1, 127 - (Int(DllStructGetData($tStructChannel2, "channel2", $i) / $iDB)), $hPen_H) EndIf Next EndFunc ;==>_GDIPlus_CreateHistogram Func _GDIPlus_CreateColorGradient($sColorChannel, $iW, $iH, $bHBitmap = True) Local $hBitmap = _GDIPlus_BitmapCreateFromScan0($iW, $iH) Local $hCtxt = _GDIPlus_ImageGetGraphicsContext($hBitmap) ;~ _GDIPlus_GraphicsSetSmoothingMode($hCtxt, 2) Local $hPen = _GDIPlus_PenCreate() _GDIPlus_PenSetLineJoin($hPen, $iLineJoinBevel) Local $i, $c For $i = 0 To $iW $c = Hex($i, 2) Switch $sColorChannel Case "L" _GDIPlus_PenSetColor($hPen, "0xFF" & $c & $c & $c) Case "C" _GDIPlus_PenSetColor($hPen, "0xFF" & $c & $c & $c) Case "R" _GDIPlus_PenSetColor($hPen, "0xFF" & $c & "0000") Case "G" _GDIPlus_PenSetColor($hPen, "0xFF00" & $c & "00") Case "B" _GDIPlus_PenSetColor($hPen, "0xFF0000" & $c) EndSwitch _GDIPlus_GraphicsDrawLine($hCtxt, $i, 0, $i, $iH, $hPen) Next _GDIPlus_GraphicsDispose($hCtxt) _GDIPlus_PenDispose($hPen) If $bHBitmap Then Local $hHBmp = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap) _GDIPlus_BitmapDispose($hBitmap) Return $hHBmp EndIf Return $hBitmap EndFunc ;==>_GDIPlus_CreateColorGradient Func _GDIPlus_CreateCheckerboardTexture($iSquareSize = 80, $iCol1 = 0xFFECECEC, $iCol2 = 0xFFDFDFDF) Local $hPatternBitmap = _GDIPlus_BitmapCreateFromScan0(2 * $iSquareSize, 2 * $iSquareSize) Local $hCtxt = _GDIPlus_ImageGetGraphicsContext($hPatternBitmap) Local $hBrush0 = _GDIPlus_BrushCreateSolid($iCol1) Local $hBrush1 = _GDIPlus_BrushCreateSolid($iCol2) _GDIPlus_GraphicsFillRect($hCtxt, 0, 0, $iSquareSize, $iSquareSize, $hBrush0) _GDIPlus_GraphicsFillRect($hCtxt, $iSquareSize, 0, $iSquareSize, $iSquareSize, $hBrush1) _GDIPlus_GraphicsFillRect($hCtxt, 0, $iSquareSize, $iSquareSize, $iSquareSize, $hBrush1) _GDIPlus_GraphicsFillRect($hCtxt, $iSquareSize, $iSquareSize, $iSquareSize, $iSquareSize, $hBrush0) Local $hTexture = _GDIPlus_TextureCreate($hPatternBitmap) _GDIPlus_GraphicsDispose($hCtxt) _GDIPlus_BitmapDispose($hPatternBitmap) _GDIPlus_BitmapDispose($hBrush0) _GDIPlus_BitmapDispose($hBrush1) Return $hTexture EndFunc ;==>_CreatePatternTexture GdipBitmapGetHistogram(), GdipBitmapGetHistogramSize() and 2 more GDI+ functions requires GDI+ v1.1 which means this will only run on Vista or higher operating systems. I hope the values are correct especially the value for luminosity. Br, UEZ
-
NOTE: TOPIC HAS BEEN MERGED TO HERE: MapIt Quest Special thanks: AdmiralAlkex, Melba23, MrCrearoR, Dragon Warrior 3, SDL MapIt is a tile world editor. MapIt was built around the concept of reversing Dragon Warrior map images. MapIt can take image input and produce a tile and world array. Changing and replacing tile / world data is easy. B/c tile world editor. CTRL+R in image above to signal replace tile action and I use "G" to Get the tile under mouse. A full list of hotkeys can be assigned in the: Help Menu\Hotkeys MapParser is a C++ project that scans images for unique tiles. MapIt can be downloaded without MapParser. MapParser can be toggled off in the Scan_Image dialog. Without MapParser, MapIt will use the Scan_Tiles() function written in AutoIt ; which is 100 * slower Idk. If MapParser.exe will not run for you: Installing Visual C++ Redistributable for Visual Studio 2015 should fix it: https://www.microsoft.com/en-us/download/details.aspx?id=48145 You can start with example world and tiles. Example world was made following these steps: Started with a tile map image of DragonWarrior3 town of: Reeve From MapIt World Menu \ New \ Scan_Image dialog, I set the area to exclude the key legend to the far right of image. After scanning the map image to world and tile array. I removed a few of the map artifacts. More work could be done on this world; removing unwanted tiles, but it is fine for now. I saved my world to disk. This creates folder: Worldname: Containing folder of Tiles and a Worldname.txt. Using The Gimp, I edited some tiles to have a transparent color: Stairs, Trees, Desk Tables, Chest-of-drawers, Chairs, Signs, Doors, Beds. I changed the world layers to 2: World Menu \ Properties. F9 Finds all selected tile on current layer and changes to a new selected tile on new layer. I used F9 to change all Trees on layer: 0 to Trees on layer: 1. Then I used F9 to change all Trees on layer: 0 to Grass on layer: 0 In this video you can see how I used the Tile Menu \ Replace From Disk option to remap tile images to my custom tiles. Conveniently my tiles already have a transparent pixel. See video for how that was done: To use the example world: First unzip the world save file: http://songersoft.com/programming/mapit/worlds/Reeve_Swapped.zip From the World Menu: choose \Load Navigate to the Reeve_Swapped.txt located in the extracted zip. Or you can scan any image. The map images I used are here: http://www.realmofdarkness.net/dq/games/nes/dw3/maps/world For download, videos, and example of created world file data; please visit the MapIt webpage: http://songersoft.com/programming/mapit/mapit_about.phtml
-
Howdy, I've gone through a lot of au3 forums, and I once had a working Imagesearch script that I got from here. However, and i'm just totally not sure how but my imagesearch scripts aren't working anymore. I'm not new to au3 but i'm not the most experienced with it's syntax/commands. Anyways, I've looked over the big threads involving imagesearch. Does anyone have a working Imagesearch x64 for win10 that is currently working as of the date with the post. Dll's and what not is fine, just when I tell the script to run, I want to be able to find the image on the screen! Can't find a working copy so if anyone has one please send it my way lol. I've taken all the imagesearch downloads and what not and have played with them but I can't get any of them working on my end, despite others saying they're working. Thanks.
- 8 replies
-
- imagesearch
- image
-
(and 2 more)
Tagged with:
-
This is a visual Crop Tool, Version 1.0.0.5 Load the image in the Crop GUIMove the cross-hair to the upper left corner where to start croppingMark the rectangle with left mouse button, releaseAdjust the position with left mouse, release (right mouse = start over)Press enterImage is saved in same folder, same format, with '_cr' added to file nameAs simple as that. Updated script, Visual Crop UDF 1.0.0.4 examples.au3 Visual Crop UDF 1.0.0.4.au3 (No obscuration of non-selected area) Visual Crop UDF 1.0.0.5.au3 (with obscuration) Ver 1.0.0.1 Avoid trespassing the edge of the GUI while selecting the crop area.Ver 1.0.0.4 Mark crop area in any directionResizing Corner grabbers (use with Ctrl Left Mouse button)Mouse cursor changes over move and resizing corner grabbersRedraw when left mouse clicking outside of crop area (restart crop), right Mouse click, same result.Magnifier de-/selectable with Ctrl-M or F2. (original function by Melba23) Note: without image ratio: Magnifier remains visible till the crop area has been marked with image ratio: Magnifier is only visible until the rectangle appears, first corner has been marked. Ver 1.0.0.5 Obscure non crop area, did some hard thinking and found my way... Missing still: ?Enjoy GreenCan Related:
-
HELLO GUYS I'm a work on a background see and click bot project I can complete it if your help me (using imagesearch , gdi+ and fastfind)
- 1 reply
-
- background
- i̇mage
-
(and 1 more)
Tagged with:
-
I would like to know if it's possible to pass an image recognition (captcha) system. What are the ways to achieve this? Just the references or links is enough for me by now. Thanks by now! Thanks!
-
Dear AutoIT Community. I am currently working on a program that will display lots of images in a scroll down GUI. I create the GUI based on the number of images, which works fine. But all images I place using GuiCtrlCreatePic above a threshold of around 32000 pixels (cant say exactly) are placed at negative locations and finally will reach 0 again and will then populate on top of the images placed there before. For $i = 1 To $Images[0] ; Get picture dimensions $hImage = _GDIPlus_ImageLoadFromFile($ImgRep & $Images[$i]) $iX = _GDIPlus_ImageGetWidth($hImage) $iY = _GDIPlus_ImageGetHeight($hImage) _GDIPlus_ImageDispose($hImage) ; Resize & place images in GUI $Pic[$i] = GUICtrlCreatePic($ImgRep & $Images[$i], $Spacer, Round($yPos, 0), $MaxImgWidth, $MaxImgWidth * ($iY / $iX)) $yPos = $yPos + $MaxImgWidth * ($iY / $iX) + $Spacer $log = $log & "|" & $yPos $currentlut = $Images[1] Next I have found a limit at 32767 pixels for some GUI elements when googling around. Can someone tell me how to circumvent that? thanks! cheers Felix
-
If possible please add or edit the comments to explain how this works. ;includes functions from other things #include <GDIPlus.au3> #include <ScreenCapture.au3> ;hotkeys HotKeySet("{ESC}", _exit) HotKeySet("{F1}", _scan) ;global variables Global $win_title ;name of the window Global $area_x ; Global $area_y ; Global $area_w ; Global $area_h ; Global $cursor ; Global $rect_file ; Global $hbmpscreen ; Global $i= 1043 ;moves the rect Global $ii= 378 ;moves the rect Global $x=1044 ;inner rect offset Global $y=501 ;inner rect offset Global $hbmprect ;image inside rect Global $hscreen ;image whole screen _GDIPlus_Startup() ;? ;display hotkeys on screen ToolTip("Press F1 to scan | Press ESC to Exit",0,0) ;infinite loop to keep prog running While 1 Sleep(100) WEnd Func _scan() ;~ reads your screen area: _read() ;~ converts screen captured into bmp _convert() ;~ . Loads converted bmp to be read _loadBMP() ;~ compares the bmp of your scanned screen to the actual screen that is being displayed _compare() EndFunc ;reads screen Func _read() $hscreen = _ScreenCapture_CaptureWnd("", WinGetHandle($win_title), $area_x, $area_y, $area_x + $area_w, $area_y + $area_h, $cursor) EndFunc ;converts screen into bmp Func _convert() _GDIPlus_BitmapCreateFromHBITMAP($hscreen) EndFunc ;loads converted screen Func _loadBMP() _GDIPlus_BitmapCreateFromFile($rect_file) EndFunc ;compares savedBMP to current screen Func _compare() ;If( below code ) = ( below code ) Then If _GDIPlus_BitmapGetPixel($hbmpscreen, ($i + $x) - $area_x, ($ii + $y) - $area_y) = _GDIPlus_BitmapGetPixel($hbmprect, $x, $y) Then ;display message box titled found with a message of found MsgBox("","","found") ;if above is not correct then EndIf EndFunc ;exit func Func _exit() Exit EndFunc
-
Hi, i searched some topics but cannot found a simple way to do that: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 615, 438, 192, 124) GUISetState(@SW_SHOW) ; I tried this but user reported that it work in 2006, not seems work actually $filemenu = GUICtrlCreateMenu ("&File") $fileitem = GUICtrlCreateMenuitem ("Open",$filemenu) GuiCtrlSetImage($fileitem, "shell32.dll", 4) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Also tried: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 615, 438, 192, 124) GUISetState(@SW_SHOW) $filemenu = TrayCreateMenu("&File") $fileitem = TrayCreateItem("Open",$filemenu) ;GuiCtrlSetImage($fileitem, "shell32.dll", 4) ;GuiCtrlSetImage(TrayItemGetHandle($fileitem), "shell32.dll", 4) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Well.. thanks in advance! Ok. I found this working example from Yashied. If i cannot find a simple then i will go with it #Include <GUIConstantsEx.au3> #Include <GUIMenu.au3> #Include <Constants.au3> #Include <WinAPI.au3> #Include <WindowsConstants.au3> Opt('MustDeclareVars', 1) Global $hMenu, $hForm, $hFile = 1000, $idNew, $idExit $hForm = GUICreate('Menu', 400, 300) $hFile = _GUICtrlMenu_CreateMenu() _GUICtrlMenu_InsertMenuItem ($hFile, 0, ' &Favorites', $idNew) _GUICtrlMenu_InsertMenuItem ($hFile, 1, '', 0) _GUICtrlMenu_InsertMenuItem($hFile, 2, ' E&xit', $idExit) $hMenu = _GUICtrlMenu_CreateMenu() _GUICtrlMenu_InsertMenuItem($hMenu, 0, '&File', 0, $hFile) _GUICtrlMenu_SetMenu($hForm, $hMenu) _GUICtrlMenu_SetItemBmp($hFile, 0, _CreateBitmapFromIcon(_WinAPI_GetSysColor($COLOR_MENU), @SystemDir & '\shell32.dll', 43, 16, 16)) _GUICtrlMenu_SetItemBmp($hFile, 2, _CreateBitmapFromIcon(_WinAPI_GetSysColor($COLOR_MENU), @SystemDir & '\shell32.dll', 27, 16, 16)) GUISetState() Do Until GUIGetMsg() = $GUI_EVENT_CLOSE Func _CreateBitmapFromIcon($iBackground, $sIcon, $iIndex, $iWidth, $iHeight) Local $hDC, $hBackDC, $hBackSv, $hIcon, $hBitmap $hDC = _WinAPI_GetDC(0) $hBackDC = _WinAPI_CreateCompatibleDC($hDC) $hBitmap = _WinAPI_CreateSolidBitmap(0, $iBackground, $iWidth, $iHeight) $hBackSv = _WinAPI_SelectObject($hBackDC, $hBitmap) $hIcon = _WinAPI_PrivateExtractIcon($sIcon, $iIndex, $iWidth, $iHeight) If Not @error Then _WinAPI_DrawIconEx($hBackDC, 0, 0, $hIcon, 0, 0, 0, 0, $DI_NORMAL) _WinAPI_DestroyIcon($hIcon) EndIf _WinAPI_SelectObject($hBackDC, $hBackSv) _WinAPI_ReleaseDC(0, $hDC) _WinAPI_DeleteDC($hBackDC) Return $hBitmap EndFunc ;==>_CreateBitmapFromIcon Func _WinAPI_PrivateExtractIcon($sIcon, $iIndex, $iWidth, $iHeight) Local $hIcon, $tIcon = DllStructCreate('hwnd'), $tID = DllStructCreate('hwnd') Local $Ret = DllCall('user32.dll', 'int', 'PrivateExtractIcons', 'str', $sIcon, 'int', $iIndex, 'int', $iWidth, 'int', $iHeight, 'ptr', DllStructGetPtr($tIcon), 'ptr', DllStructGetPtr($tID), 'int', 1, 'int', 0) If (@error) Or ($Ret[0] = 0) Then Return SetError(1, 0, 0) EndIf $hIcon = DllStructGetData($tIcon, 1) If ($hIcon = Ptr(0)) Or (Not IsPtr($hIcon)) Then Return SetError(1, 0, 0) EndIf Return $hIcon EndFunc ;==>_WinAPI_PrivateExtractIcon Ok, i noticed that is a pain create submenu with _GUICtrlMenu_CreatePopup to do like in Tray, and Tray better located, then i need images/icon with Tray functions, some workaround??
-
Func dg_get_images() $x1=0 $y1=0 ;MsgBox(0,"start","start") do $result = _ImageSearch("C:\Users\Server\Desktop\my project\image.png",1,$x1,$y1,0) until $result = 1; if $result=1 Then MouseMove($x1,$y1,3) MouseClick("left", $x1,$y1, 1) WinWait("[Title:TightVNC File Transfer]", "", 10) EndIf this code works when i search the image, but when i change the location of the desktop icon it can't find the desktop icon anymore. i wanna try image search area. but i don't know how to use it because i cant understand the parameter for the image search area. please help me how to solve it thank you in advance.
- 1 reply
-
- image search
- image search area
-
(and 2 more)
Tagged with:
-
I am busy with building a solution for change monitoring of VOIP call program and to be properly automated means among others need for some limited OCR functionality. Current works of others are way too much overkill for this case what makes the need to build it myself. But to do it properly I significantly have to increase my knowledge about digital graphics management. For now I already have discovered here and there some mind blowing Autoit miracles what can be achieved with Windows own possibilities to manipulate that what is output to the monitor. And as far I can judge there are 2 options to process graphics without use of any external libraries like ImageMagick, FreeImage and so on. These are: WinAPI GDIPlus It is for me quite obvious to have various holes in general understanding of graphics and it is once more very clear what advantages gives consistent general study in 1 or another official institutions like University. Cause there you are introduced into certain domain of knowledge in a way which usually has been perfected over long period of time. So you are not overloaded by stuff which requires a certain amount of information to be initially clear for you. For example, before starting to solve physics you first learn to read, count and so on and then move to subjects like physics. Though in my case opportunity to study in such educational system I had only for 8 years, from my 7th to 15th year of age in the country that was falling apart now Ukraine but used to be USSR, was all what it was. After have immigrated to Netherlands possibilities to study further haven't occur. And this therefor causes often various implications when going deep in that or another field of practical knowledge acquiring for any needed physical result, like programming to perform enormous amount of tasks. In this particular case automating VOIP call program. Anyway, right now I think the best direction to move is to concentrate on as basic as possible image management and if someone would maybe explain in general what is a pixel will definitely help. Particularly I am very curious about how to do picture manipulations in Autoit. Especially would help a lot to produce eventually following functions: createImage($imageFileName, $width, $height, $color) readImagePixel($imageFileName, $x, $y) writeImagePixel($imageFileName, $x, $y) I do not know exactly how image is handled in computer but preferably above mentioned functions should deal with so far possible origin of graphics creation on computer. But nevertheless I definitely would love to hear any proposition for solution. The problem with explaining screenshots: VOIPConnect full Window Part of Window with control to monitor for changes Exact location of area where actual changes occur and have to be processed It comes down to a rectangle of approximately 51 pixel wide and 7 pixel high. In fact if I get to learn as far as to be able exactly read, write and compare 2 images consistently across different computers I could narrow down then even further the area to watch as little as a square of 2-5 pixels wide. To finish here is last detail about particularly no need for ultra fast solution at all. This because it is needed only once when it is first run on a new computer and to have to wait few minutes while it is being set instead of just a few seconds make no sence. This is it and what I too think to do beside this very particular case is to purify out beautiful generic Autoit functions for core image manipulation by using WinAPI or/and GDIPlus.