Search the Community
Showing results for tags 'picture'.
-
Hello, I would like to know how to go about making the following item clear and transparent. They're currently being highlight by a blue/black bar over the texts. I've read through pages and pages of "transparent group, radios, and checkboxes" but none looks like a simple implemenation nor does it apply to my case. Groups Text Radio Text Also, I'm unable to see my tabs perhaps it's being hidden by the background picture? (see figure 2 for what it's supposed to look like). Using the code from AdmiralClaws, it made the radio graphic or style a little plain and I would like to restore it. I don't need the tab section transparent, just the dark grey area around it. Example: $chk = GUICtrlCreateCheckbox("This is checkbox - Lorem ipsum dolor sit amet.", 20, 20) DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle(-1), "wstr", 0, "wstr", 0) $lbl = GUICtrlCreateLabel("This is label - Lorem ipsum dolor sit amet", 20, 100) $rdo = GUICtrlCreateRadio("This is radio - Lorem ipsum dolor sit amet", 20, 180) DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle(-1), "wstr", 0, "wstr", 0) Test Program #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Example() Func Example() ; Create a GUI with various controls. Local $hGUI = GUICreate("Example", 400, 300) ; GUICtrlCreatePic (".\background.bmp", 0, 0, 400, 300) GUICtrlCreateTab (20, 20, 360, 260) GUICtrlCreateTabItem ("Option 1") GUICtrlCreateGroup ("Radio", 40, 60, 320, 200) $radio1 = GUICtrlCreateRadio ("Radio 1", 60, 80) ;DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($radio1), "wstr", 0, "wstr", 0) $radio2 = GUICtrlCreateRadio ("Radio 2", 60, 110) ;DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($radio2), "wstr", 0, "wstr", 0) GUICtrlCreateTab (30, 30, 360, 260) GUICtrlCreateTabItem ("Option 2") GUICtrlCreateGroup ("Radio", 40, 60, 320, 200) $radio3 = GUICtrlCreateRadio ("Radio 3", 60, 80) ;DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle(-1), "wstr", 0, "wstr", 0) $radio4 = GUICtrlCreateRadio ("Radio 4", 60, 110) ;DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle(-1), "wstr", 0, "wstr", 0) ; Display the GUI. GUISetState(@SW_SHOW, $hGUI) ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd ; Delete the previous GUIs and all controls. GUIDelete($hGUI) EndFunc ;==>Example (Figure 1) (Figure 2)
-
Automate the change of the (current) user account picture was a script that I was missing, but I was sure to find an easy command line, like a simple powershell. It was not the case, I found only methods to change it in Active Directory environments, and my goal was to change the account picture also in freshly installed win 10/11 non domain OSes, and it works also in domain machines. The focus is to take care of every aspect of the process. The code: #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=Icone\angryRabbit.ico #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** ;UAP ;User Account Picture ;()NSC 2023 ;notes ; only way to access 64-bit node in a 32-bit compiled script is using HKLM64 ;Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AccountPicture\Users ;main inspiration ;https://social.msdn.microsoft.com/Forums/sqlserver/en-US/3f50b25a-4c47-4bc8-959e-1108419288a7/how-to-set-specific-users-account-picture-from-cmd?forum=scripting ;PSexec to use as System '-s' switch ;https://learn.microsoft.com/it-it/sysinternals/downloads/psexec ;image processing ;https://imagemagick.org/index.php ;https://imagemagick.org/script/command-line-processing.php ;needed VCredist ;https://learn.microsoft.com/it-it/cpp/windows/latest-supported-vc-redist?view=msvc-170 ;https://aka.ms/vs/17/release/vc_redist.x64.exe ;permissions SETACL ;https://helgeklein.com/setacl/ ;https://www.autoitscript.com/forum/topic/162656-change-registry-key-permissions/?do=findComment&comment=1182956 ;interesting but not used (AD related) ;https://woshub.com/how-to-set-windows-user-account-picture-from-active-directory/ #RequireAdmin #include <Security.au3> #include <Array.au3> #include <File.au3> #include <String.au3> #include <_Gollog.au3> $mygui = "UAP - NSC 2023" gollog_ini($mygui, 600, 300, 200, 200, "0x050980", "0xf2dcc3", "consolas") ;f2dcc3 Global $tempfolder = "c:\temp", $ver = "V.1.0" Global $onlyexe4conversion = "magick.exe", $exe4conversion = $tempfolder & "\" & $onlyexe4conversion Global $onlyexe4regperm = "setacl.exe", $exe4regperm = $tempfolder & "\" & $onlyexe4regperm Global $onlyexe4PsExec = "psexec64.exe", $exe4PsExec = $tempfolder & "\" & $onlyexe4PsExec Global $vcredist = $tempfolder & "\" & "VC_redist.x64.exe" Global $registrypath = "hklm64\SOFTWARE\Microsoft\Windows\CurrentVersion\AccountPicture\Users\" Global $registrypath4SETACL = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\AccountPicture\Users\" Global $aSizes[11] = ["32x32", "40x40", "48x48", "64x64", "96x96", "192x192", "208x208", "240x240", "424x424", "448x448", "1080x1080"] Gollog("START UAP " & $ver) Global $sConsoleUser = _GetConsoleUser() Gollog("Console User: " & $sConsoleUser & @CRLF) Global $aUserProfile = _GetProfile($sConsoleUser) Gollog("Console User Path: " & $aUserProfile[1][1] & @CRLF) Global $folder4accountPictures = $aUserProfile[1][1] & "\" & "UAP" ;_ArrayDisplay($aUserProfile, "current USER") Global $aexpprof = _StringExplode($aUserProfile[1][2], "\") Global $CUreg = $aexpprof[UBound($aexpprof) - 1] Gollog("current user SID: " & $CUreg & @CRLF) ;TEST all users Gollog("enumerating all users:") Global $allUserProfiles = _GetProfile() For $i = 1 To UBound($allUserProfiles) - 1 Gollog($allUserProfiles[$i][0] & " " & $allUserProfiles[$i][2]) Next ;_ArrayDisplay($allUserProfiles, "all USERS") createFolder4userPictures() TempCreate() SetRegPermissions() VcRedist() GenPicS() Gollog("END UAP") Func GenPicS() ;image prepare Gollog("picking image for avatar") Local $sourceimg = FileOpenDialog("Select Image for your User Profile", @UserProfileDir & "\" & "downloads", "Images (*.png;*.jpg;*.jpeg;*.gif;*.bmp)", 1) Local $sDrive = "", $sDir = "", $sFileName = "", $sExtension = "" Local $aPathSplit = _PathSplit($sourceimg, $sDrive, $sDir, $sFileName, $sExtension) ;registry prepare If RegDelete($registrypath & $CUreg) Then Gollog("regdelete ok " & @CRLF) Gollog($registrypath & $CUreg & @CRLF) Else Gollog("regdelete error " & @error & @CRLF) Gollog($registrypath & $CUreg & @CRLF) EndIf If RegWrite($registrypath & $CUreg) Then Gollog("regwrite root ok " & @CRLF) Else Gollog("regwrite root error " & @error & @CRLF) EndIf For $i = 0 To UBound($aSizes) - 1 ;image conversion ShellExecuteWait($exe4conversion, $sourceimg & " -resize " & $aSizes[$i] & " " & $folder4accountPictures & "\" & $sFileName & "_" & $aSizes[$i] & $sExtension) ;registry write Local $apartsize = _StringExplode($aSizes[$i], "x") If RegWrite($registrypath & $CUreg, "Image" & $apartsize[0], "REG_SZ", $folder4accountPictures & "\" & $sFileName & "_" & $aSizes[$i] & $sExtension) Then Gollog("regewrite image ok " & $aSizes[$i] & @CRLF) Gollog($registrypath & $CUreg & " Image" & $apartsize[0] & " REG_SZ " & $folder4accountPictures & "\" & $sFileName & "_" & $aSizes[$i] & $sExtension) Else Gollog("regwrite image error " & @error & @CRLF) Gollog($registrypath & $CUreg & " Image" & $apartsize[0] & " REG_SZ " & $folder4accountPictures & "\" & $sFileName & "_" & $aSizes[$i] & $sExtension) EndIf Next EndFunc ;==>GenPicS Func VcRedist() Gollog("installing Microsoft Visual C++ Redistributable ") ShellExecuteWait($vcredist, "/install /passive /norestart") EndFunc ;==>VcRedist Func SetRegPermissions() Gollog("creating file to set registry permissions") ;writing bat file Local $batfile = $tempfolder & "\" & "UAPsetacl.bat" If FileExists($batfile) Then FileDelete($batfile) gollog("deleted old " & $batfile) EndIf Local $hFileOpen = FileOpen($batfile, $FO_APPEND) If $hFileOpen = -1 Then MsgBox($MB_SYSTEMMODAL, "", "An error occurred whilst writing the UAPsetacl.bat file", 3) GOLLOG("An error occurred whilst writing the UAPsetacl.bat file") Exit EndIf FileWriteLine($hFileOpen, 'c:\temp\setacl.exe -on "' & $registrypath4SETACL & $CUreg & '" -ot reg -actn ace -ace "n:Administrators;p:full"') FileClose($hFileOpen) Gollog("set registry permissions") ;launch permission set on registry ShellExecuteWait($exe4PsExec, " -s -accepteula " & $batfile) EndFunc ;==>SetRegPermissions Func TempCreate() Gollog("deploying necessary temp files") If Not FileExists($tempfolder) Then DirCreate($tempfolder) FileInstall("C:\nsc_TEST\resources\imagemagick\magick.exe", $exe4conversion, 1) FileInstall("C:\nsc_TEST\resources\SetACL\64 bit\setacl.exe", $exe4regperm, 1) FileInstall("C:\NSC_test\resources\PSExec\PsExec64.exe", $exe4PsExec, 1) FileInstall("C:\nsc_TEST\resources\VCredist\VC_redist.x64.exe", $vcredist, 1) EndFunc ;==>TempCreate ;Create folder for user pictures - cleaning pre existing Func createFolder4userPictures() Gollog("creating folder for new avatar pictures") If FileExists($folder4accountPictures & "\") Then DirRemove($folder4accountPictures, 1) EndIf DirCreate($folder4accountPictures) EndFunc ;==>createFolder4userPictures ;Use WMI query to get user logged onto console Func _GetConsoleUser() Local $objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!//.") Local $colUsers, $objUser Local $strAccount $colUsers = $objWMIService.InstancesOf("Win32_ComputerSystem") For $objUser In $colUsers $strAccount = $objUser.UserName Next If $strAccount <> "" Then Return $strAccount Else Return (1) EndIf EndFunc ;==>_GetConsoleUser ; #FUNCTION# ==================================================================================================================================== ; Name...........: _GetProfile ; Description ...: Determine each user's Profile folder, the user's SID and if the profile is loaded to the registry ; Syntax.........: _GetProfile([$sAccount, $sComputer]) ; Parameters ....: $sAccount - User account name, defaults to all users ; $sComputer - Computer name, the local computer is default ; Requirement(s).: Service 'RemoteRegistry' running on the target computer ; When the target computer is the local computer, the 'RemoteRegistry' service isn't required ; Return values .: An array containing the path to each user's profile folder, the user's SID ; The array returned is two-dimensional and is made up as follows: ; $array[0][0] = Number of profiles ; $array[1][0] = 1st user name ; $array[1][1] = Path to 1st user profile ; $array[1][2] = 1st user registry hive ; $array[1][3] = 1 if 1st user profile is loaded to the registry, 0 if not ; $array[2][0] = 2nd user name ; $array[2][1] = Path to 2nd user profile ; $array[2][2] = 2nd user registry hive ; $array[2][3] = 1 if 2nd user profile is loaded to the registry, 0 if not ; ... ; $array[n][0] = nth user name ; $array[n][1] = Path to nth user profile ; $array[n][2] = nth user registry hive ; $array[n][3] = 1 if nth user profile is loaded to the registry, 0 if not ; Author ........: engine ; Modified.......: AdamUL ; Remarks .......: ; Related .......: ; Link ..........; ; Example .......; _GetProfile("Default User") to get Default User's profile data on the local computer ; =============================================================================================================================================== Func _GetProfile($sAccount = "", $sComputer = @ComputerName) Local $avArray[1][4], $sDefaultUser, $sEnv Local Const $sProfileListKey = "\\" & $sComputer & "\HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" Local Const $sRootKey = "\\" & $sComputer & "\HKEY_USERS\" Local Const $sDefaultUser1 = RegRead($sProfileListKey, "DefaultUserProfile") Local Const $iDefaultUser1Error = @error Local Const $sDefaultUser2 = RegRead($sProfileListKey, "Default") Local Const $iDefaultUser2Error = @error If $iDefaultUser1Error And $iDefaultUser2Error Then $avArray[0][0] = 0 Return $avArray EndIf If $iDefaultUser1Error Then $sDefaultUser = "Default" Else $sDefaultUser = $sDefaultUser1 EndIf If $sAccount = "" Or $sAccount = $sDefaultUser Then Local $iInstance, $sSID While 1 $iInstance += 1 $sSID = RegEnumKey($sProfileListKey, $iInstance) If @error Then ExitLoop If StringLen($sSID) > 8 Then ProfileAdd($avArray, $sSID, $sProfileListKey, $sRootKey) WEnd Local $u = UBound($avArray), $iSum For $k = 1 To $u - 1 $iSum += $avArray[$k][3] Next ReDim $avArray[$u + 1][4] $avArray[$u][0] = $sDefaultUser $avArray[$u][1] = RegRead($sProfileListKey, "ProfilesDirectory") & "\" & $sDefaultUser If $iSum = 0 Then $avArray[$u][2] = "\\" & $sComputer & "\HKEY_CURRENT_USER" $avArray[$u][3] = 1 Else Local $avDomain, $iN = 998, $sDSID, $avDU $avDomain = _Security__LookupAccountName($sComputer, $sComputer) Do $iN += 1 $sDSID = $avDomain[0] & "-" & $iN $avDU = _Security__LookupAccountSid($sDSID, $sComputer) Until $avDU = 0 $avArray[$u][2] = $sRootKey & $sDSID $avArray[$u][3] = 0 EndIf If $sAccount = $sDefaultUser Then Local $avNew[2][4] = [["", "", "", ""], [$avArray[$u][0], $avArray[$u][1], $avArray[$u][2], $avArray[$u][3]]] $avArray = $avNew EndIf Else Local $avSID = _Security__LookupAccountName($sAccount, $sComputer) If $avSID = 0 Then $avArray[0][0] = 0 Return $avArray Else ProfileAdd($avArray, $avSID[0], $sProfileListKey, $sRootKey) EndIf EndIf $avArray[0][0] = UBound($avArray) - 1 For $j = 1 To $avArray[0][0] $sEnv = StringRegExp($avArray[$j][1], "\x25\S{1,128}\x25", 1) If Not @error Then $avArray[$j][1] = StringReplace($avArray[$j][1], $sEnv[0], EnvGet(StringReplace($sEnv[0], "%", ""))) Next Return $avArray EndFunc ;==>_GetProfile ; #INTERNAL_USE_ONLY#============================================================================================================================ ; Name...........: ProfileAdd ; Description ...: Add profile data to an array that will be returned by _GetProfile function ; Syntax.........: ProfileAdd($avArray, $sSID, $sProfileListKey, $sRootKey) ; Parameters ....: $avArray - Array ; $sSID - Account SID ; $sProfileListKey - Constant defined inside _GetProfile function ; $sRootKey - Constant defined inside _GetProfile function ; Requirement(s).: ; Return values .: ; Author ........: engine ; Modified.......: AdamUL ; Remarks .......: For internal use only ; Related .......: ; Link ..........; ; Example .......; ; =============================================================================================================================================== Func ProfileAdd(ByRef $avArray, $sSID, Const $sProfileListKey, Const $sRootKey) Local $sPath, $i Local $asSplit = Split_sKey("\" & $sProfileListKey) Local $avUser = _Security__LookupAccountSid($sSID, $asSplit[0]) If Not @error And $avUser <> 0 Then If $avUser[2] = 1 Then $sPath = RegRead($sProfileListKey & "\" & $sSID, "ProfileImagePath") If Not @error Then $i = UBound($avArray) ReDim $avArray[$i + 1][4] $avArray[$i][0] = $avUser[0] $avArray[$i][1] = $sPath $avArray[$i][2] = $sRootKey & $sSID RegEnumKey($sRootKey & $sSID, 1) If @error Then $avArray[$i][3] = 0 Else $avArray[$i][3] = 1 EndIf EndIf EndIf EndIf EndFunc ;==>ProfileAdd ; #INTERNAL_USE_ONLY#============================================================================================================================ ; Name...........: Split_sKey ; Description ...: Splits $sKey between computername, username and keyname ; Syntax.........: Split_sKey($sKey) ; Parameters ....: $sKey - Reg function main key ; Requirement(s).: ; Return values .: ; Author ........: engine ; Modified.......: ; Remarks .......: For internal use only ; Related .......: ; Link ..........; ; Example .......; ; =============================================================================================================================================== Func Split_sKey($sKey) Local $asArray[3] If StringInStr($sKey, "\\\") = 1 Then Local $asComputer = StringRegExp($sKey, "\\\\\\[^\\]*\\", 1) If Not @error Then $asArray[0] = StringTrimRight(StringTrimLeft($asComputer[0], 3), 1) $sKey = StringReplace($sKey, $asComputer[0], "\", 1) If Not StringInStr($sKey, "\\") = 1 Then $sKey = StringTrimLeft($sKey, 1) EndIf EndIf If $asArray[0] = "" Then $asArray[0] = @ComputerName If StringInStr($sKey, "\\") = 1 And Not StringInStr($sKey, "\\\") = 1 Then Local $asUser = StringRegExp($sKey, "\\\\[^\\]*\\", 1) If Not @error Then $asArray[1] = StringTrimRight(StringTrimLeft($asUser[0], 2), 1) $sKey = StringReplace($sKey, $asUser[0], "", 1) EndIf EndIf If Not (StringInStr($sKey, "\") = 1 Or StringInStr($sKey, "\", 0, -1) = StringLen($sKey) Or StringInStr($sKey, "\\")) Then $asArray[2] = $sKey EndIf Return $asArray EndFunc ;==>Split_sKey 3+1 external executables are needed, look at notes at the top of che code. The _gollog udf is here. The abstract is this : it determines the current user SID it gives control to the admin user to the right registry entries, because they are changeable only by "system" account") it creates the needed pictures and write down to the registry the correct keys. Research on these topics was made in this thread.
-
Hi everyone, I have created a ListView that is in a tab, and I want to display an image in that tab, with the ListView on top. However, the image still appears on top of my ListView. If I remove the tabs everything works. I looked at the autoit documentation and the <GuiListView.au3> documentation , I can't figure out how to display a background image, and put on top a ListView, inside a tab. 😥 Here is the code: Opt("GUIOnEventMode", 1) $Form1 = GUICreate($Titre, 700, 627, $Form1Width, $Form1Height); main window $tabulation = GUICtrlCreateTab(148,0,700,580); creating tabs $tab1=GUICtrlCreateTabItem("Tab 1"); first tab GUICtrlSetState(-1, $GUI_SHOW); this tab is selected by default $Pic1 = GUICtrlCreatePic("image.jpg", 0, 30, 700, 627) GUICtrlSetState(-1, $GUI_DISABLE). $idListview = GUICtrlCreateListView("list 1|list 2|list 3", 200, 50, 390, 200) GUISetState(@SW_SHOW) While 1 Sleep(100) WEnd Thank you in advance.
-
Is there a (simple) way to make your script using a picture-control to resize the gui? This would be useful for a transparant pop-up window with a custom made theme using picture controls: $Form = GUICreate('', 301, 173, 5, 5, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST)) GUICtrlCreatePic(@scriptdir & "\resize_win.bmp", 0, 73, 20, 51) ; some api call or code telling the os to use this picture as a resize border GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT) GUISetState(@SW_SHOW) While True if GUIGetMsg() = $GUI_EVENT_CLOSE then Exit WEnd EDIT: to make it more clear what i wanna do, if you go with the mouse arrow over the border of a re-sizable window the arrow changes to a "resize" arrow, you click and drag the border and then the window size adjusts to the mouse position until you release the mouse button. I want my picture control to be used the same way as the resize border to resize my window.
-
How to check If we pressed with Left mouse button on the Picture Control that was Created using the GUICtrlCreatePic Function $Form = GUICreate("Form", 615, 437, 184, 123, BitOR($WS_MINIMIZEBOX,$WS_POPUP,$WS_GROUP)) $Pic1 = GUICtrlCreatePic("C:\pb_rUu4L_400x400.jpg", 144, 56, 337, 209) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() EndSwitch WEnd
-
All, I need some help with the following: 1. Finding an image in a Word doc. I have read the help file but I cannot figure out how to reference the image in the Word doc. 2. Adding a hyperlink to that image. 3. How would I loop the add hyperlink (text) and add hyperlink (image) to replace multiple links in a document. I have the add image and hyperlink working with the following code: $pic = "<PHOTO>" $picpath = IniRead(@ScriptDir & "\Config\Config.ini", "User Info", "Picture", 0) Local $oRange = _Word_DocFind($oDoc, $pic) _Word_DocPictureAdd($oDoc, $picpath, Default, Default, $oRange) _Word_DocFindReplace($oDoc, $pic, "", Default, 0, True, True) If @error Then $file1 = FileOpen("C:\Tech\Log_Files\_Error_Logs\Error_LOG.txt", 9) _FileWriteLog($file1, "," & @ComputerName & "," & @UserName & ",Error adding a picture to the document. " & $picpath & " " & " @error = " & @error & " @extended = " & @extended) FileClose($file1) EndIf $Link = "<LINKEDIN>" $LinkedIn = IniRead(@ScriptDir & "\Config\Config.ini", "User Info", "LinkedIn", 0) Local $oRange = _Word_DocFind($oDoc, $Link) _Word_DocLinkAdd($oDoc, $oRange, $LinkedIn, Default, "Click here to visit my LinkedIn page. " & @CRLF & $LinkedIn, "LinkedIn") If @error Then $file1 = FileOpen("C:\Tech\Log_Files\_Error_Logs\Error_LOG.txt", 9) _FileWriteLog($file1, "," & @ComputerName & "," & @UserName & ",Error adding a link to the document. " & $LinkedIn & " " & " @error = " & @error & " @extended = " & @extended) FileClose($file1) EndIf I just can't figure out how to find the images in a Word doc. Thanks for reading my post!
-
Can someone please explain me why a graphic control can't overlap a picture? My gui uses a background picture and a graphic that overlaps. it doesn't matter what I try, the picture always overlaps the graphic control... this doesn't help either: Graphic control can be clicked so they should not overlap with other controls. If overlap is needed it is important to disable the graphic control : GUICtrlSetState(-1, $GUI_DISABLE).regards
-
I have lot's of images like this http://postimg.org/image/uz24d8z27/ http://postimg.org/image/5isx6mc61/ i would like to crop the page number (the arabic number on the top of the page) so it would be something like this ... any ideas ?
-
Version 1.0.0.7
848 downloads
ImageSplitter split an image into pieces that can be used • for collage art. • for website optimisation (speed up the preview of images) • for printing purposes (big poster) • for create a puzzle. Load an image by menu or by drag&drop (jpg, gif, png and bmp are supported) Choose a format and select Columns and Rows count you want. Once Split Image processing is finished a folder with all splitted image parts will be opened. Parts of image are from left to right and from top to bottom. executable : -
ImageSplitter v1.0.0.7 ImageSplitter split an image into pieces that can be used - for collage art. - for website optimisation (speed up the preview of images) - for printing purposes (big poster) - for create a puzzle. Load an image by menu or by drag&drop (jpg, gif, png and bmp are supported) Choose a format and select Columns and Rows numbers you want. Once Split Image processing is finished a folder with all splitted image parts will be opened. Parts of image are from left to right and from top to bottom. Button was made online with chimply.com the easy and free buttons generator ! ChangeLog version 1.0.0.7 : DPI Resolution can be preserved as original or changed. Multi files Split is now possible ( Only by Menu - Open - Multi files Split) previous downloads : 189 ImageSplitter v1.0.0.7.au3 is available in the Download Section Hope you like it !
-
Hi Guys and Gals, is there a udf to work with images, specifically watermarking images, either individually or in batch thanks in advance RichE
-
This is my attempt on loading and let the user select only a portion of an image. I found some samples by Melba23 and UEZ and tried to glue things together. I think I've almost done it but still have some problems: Resizing and displaying image is not always proportional (just try the script with different resolution images, expecially big ones) The rectangle selection to crop is wrong: it actually selects a different region of the screen Function _GUICtrlStatic_SetImage does not work. Temporarily fixed using _WinAPI_DeleteObject instead...Any hint would be greatly appreciated! #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #Include <ScreenCapture.au3> #Include <Misc.au3> #include <StaticConstants.au3> Global $iX1, $iY1, $iX2, $iY2, $aPos, $sMsg, $sBMP_Path Global Const $IMAGE_BITMAP = 0 ; Needed for GUICtrlSendMsg. Global Const $STM_SETIMAGE = 0x0172 ; Needed for GUICtrlSendMsg. Local $GUIimg_title,$GUIwidth,$GUIheight,$GUILeft,$GUITop Local $filename = FileOpenDialog("Select image", @ScriptDir, "Image (*.jpg;*.bmp)", 3) $GUIimg_title = $filename _GDIPlus_Startup() Local $imagefromfile = _GDIPlus_ImageLoadFromFile($filename) ;Create an image object based on a file [OK] **NOTA PER LA ROTAZIONE VEDI HELP FILE!** Local $GUIwidth = _GDIPlus_ImageGetWidth ($imagefromfile) Local $GUIheight = _GDIPlus_ImageGetHeight ($imagefromfile) ;try to create a smaller window if the pictures is bigger than Desktop If $GUIwidth > @DesktopWidth Then $GUIwidth = @DesktopWidth - 6 EndIf If $GUIheight > @DesktopHeight Then $GUIheight = @DesktopHeight - 73 ; rought attempt to show the window bar... EndIf $GUILeft = (@DesktopWidth - $GUIwidth) / 2 $GUITop = (@DesktopHeight - $GUIheight) / 2 $hBitmap_resized = _GDIPlus_ScaleImage($imagefromfile, $GUIwidth, $GUIheight); attempts to scale the image but it not always proportional.. _GDIPlus_ImageDispose($imagefromfile) ; Display image $hBitmap_GUI = GUICreate($GUIimg_title & " [" & $GUIwidth & "x" & $GUIheight & "]", $GUIwidth, $GUIheight,$GUILeft,$GUITop) $hPic = GUICtrlCreatePic("", 0, 0, $GUIwidth, $GUIheight) GUISetState() Local $hHBitmap_resized = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap_resized); creates an handle _WinAPI_DeleteObject(GUICtrlSendMsg($hPic, $STM_SETIMAGE, $IMAGE_BITMAP, $hHBitmap_resized)) ; Updates the GUI - It works instead of _GDIPlus_ImageDispose($hHBitmap_resized) [OK] _WinAPI_DeleteObject($hHBitmap_resized) ;~ _GUICtrlStatic_SetImage($hPic, $hBitmap_resized); does not seems to work... using _WinAPI_DeleteObject above _GDIPlus_Shutdown() ; Create GUI ;~ Local $GUITop = $hMain_GUI = GUICreate("Select a function", 480, 50) $hRect_Button = GUICtrlCreateButton("Crop", 10, 10, 80, 30) $hRot_90_plus_Button = GUICtrlCreateButton("+90°", 95, 10, 50, 30) $hRot_90_minus_Button = GUICtrlCreateButton("-90°", 150, 10, 50, 30) $hOK_Button = GUICtrlCreateButton("OK", 305, 10, 50, 30) $hCancel_Button = GUICtrlCreateButton("Cancel", 360, 10, 80, 30) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $hCancel_Button FileDelete(@ScriptDir & "Rect.bmp") Exit Case $hRect_Button GUISetState(@SW_HIDE, $hMain_GUI) Mark_Rect($GUIwidth,$GUIheight,$GUILeft,$GUITop);selects wrong area!! ; Capture selected area $sBMP_Path = @ScriptDir & "Rect.bmp" ;~ _ScreenCapture_Capture($sBMP_Path, $iX1, $iY1, $iX2, $iY2, False) _ScreenCapture_CaptureWnd($sBMP_Path, $hBitmap_GUI,$iX1, $iY1, $iX2, $iY2, False) GUISetState(@SW_SHOW, $hMain_GUI) GUIDelete($hBitmap_GUI) ; Display image $hBitmap_GUI = GUICreate("Selected Rectangle", $iX2 - $iX1 + 1, $iY2 - $iY1 + 1, 100, 100) $hPic = GUICtrlCreatePic(@ScriptDir & "Rect.bmp", 0, 0, $iX2 - $iX1 + 1, $iY2 - $iY1 + 1) GUISetState() case $hRot_90_plus_Button ; Rotate +90 case $hRot_90_minus_Button ;Rotate -90 case $hOK_Button ;should return the resulting picture object EndSwitch WEnd ; ------------- Func Mark_Rect($width = @DesktopWidth, $height = @DesktopHeight, $Left = 0, $Top = 0);Made by Melba23 - Arguments added by me Local $aMouse_Pos, $hMask, $hMaster_Mask, $iTemp Local $UserDLL = DllOpen("user32.dll") Global $hRectangle_GUI = GUICreate("", $width, $height, $Left, $Top, $WS_POPUP, $WS_EX_TOOLWINDOW + $WS_EX_TOPMOST);create fading _GUICreateInvRect($hRectangle_GUI, 0, 0, 1, 1) GUISetBkColor(0) WinSetTrans($hRectangle_GUI, "", 95) GUISetState(@SW_SHOW, $hRectangle_GUI) GUISetCursor(3, 1, $hRectangle_GUI) ; Wait until mouse button pressed While Not _IsPressed("01", $UserDLL) Sleep(10) WEnd ; Get first mouse position $aMouse_Pos = MouseGetPos() $iX1 = $aMouse_Pos[0] $iY1 = $aMouse_Pos[1] ; Draw rectangle while mouse button pressed While _IsPressed("01", $UserDLL) $aMouse_Pos = MouseGetPos() ; Set in correct order if required If $aMouse_Pos[0] < $iX1 Then $iX_Pos = $aMouse_Pos[0] $iWidth = $iX1 - $aMouse_Pos[0] Else $iX_Pos = $iX1 $iWidth = $aMouse_Pos[0] - $iX1 EndIf If $aMouse_Pos[1] < $iY1 Then $iY_Pos = $aMouse_Pos[1] $iHeight = $iY1 - $aMouse_Pos[1] Else $iY_Pos = $iY1 $iHeight = $aMouse_Pos[1] - $iY1 EndIf _GUICreateInvRect($hRectangle_GUI, $iX_Pos, $iY_Pos, $iWidth, $iHeight) Sleep(10) WEnd ; Get second mouse position $iX2 = $aMouse_Pos[0] $iY2 = $aMouse_Pos[1] ; Set in correct order if required If $iX2 < $iX1 Then $iTemp = $iX1 $iX1 = $iX2 $iX2 = $iTemp EndIf If $iY2 < $iY1 Then $iTemp = $iY1 $iY1 = $iY2 $iY2 = $iTemp EndIf GUIDelete($hRectangle_GUI) DllClose($UserDLL) EndFunc ;==>Mark_Rect Func _GUICreateInvRect($hWnd, $iX, $iY, $iW, $iH) $hMask_1 = _WinAPI_CreateRectRgn(0, 0, @DesktopWidth, $iY) $hMask_2 = _WinAPI_CreateRectRgn(0, 0, $iX, @DesktopHeight) $hMask_3 = _WinAPI_CreateRectRgn($iX + $iW, 0, @DesktopWidth, @DesktopHeight) $hMask_4 = _WinAPI_CreateRectRgn(0, $iY + $iH, @DesktopWidth, @DesktopHeight) _WinAPI_CombineRgn($hMask_1, $hMask_1, $hMask_2, 2) _WinAPI_CombineRgn($hMask_1, $hMask_1, $hMask_3, 2) _WinAPI_CombineRgn($hMask_1, $hMask_1, $hMask_4, 2) _WinAPI_DeleteObject($hMask_2) _WinAPI_DeleteObject($hMask_3) _WinAPI_DeleteObject($hMask_4) _WinAPI_SetWindowRgn($hWnd, $hMask_1, 1) EndFunc Func _GDIPlus_ScaleImage($hImage, $iW, $iH, $iInterpolationMode = 7) ;coded by UEZ 2012 Local $hBitmap = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromScan0", "int", $iW, "int", $iH, "int", 0, "int", 0x0026200A, "ptr", 0, "int*", 0) If @error Then Return SetError(3, 0, 0) $hBitmap = $hBitmap[6] Local $hBmpCtxt = _GDIPlus_ImageGetGraphicsContext($hBitmap) DllCall($ghGDIPDll, "uint", "GdipSetInterpolationMode", "handle", $hBmpCtxt, "int", $iInterpolationMode) _GDIPlus_GraphicsDrawImageRect($hBmpCtxt, $hImage, 0, 0, $iW, $iH) _GDIPlus_ImageDispose($hImage) _GDIPlus_GraphicsDispose($hBmpCtxt) Return $hBitmap EndFunc Func _GUICtrlStatic_SetImage($iCtrlId, $hBitmap) Local Const $STM_SETIMAGE = 0x0172 Local Const $IMAGE_BITMAP = 0 Local Const $SS_BITMAP = 0xE Local Const $GWL_STYLE = -16 If IsHWnd($iCtrlId) Then If WinGetProcess($iCtrlId) <> @AutoItPID Then Return SetError(1,0,0) Else $iCtrlId = GUICtrlGetHandle($iCtrlId) If Not $iCtrlId Then Return SetError(2,0,0) EndIf ; set SS_BITMAP style to control Local $oldStyle = DllCall("user32.dll", "long", "GetWindowLong", "hwnd", $iCtrlId, "int", $GWL_STYLE) If @error Then Return SetError(3, 0, 0) DllCall("user32.dll", "long", "SetWindowLong", "hwnd", $iCtrlId, "int", $GWL_STYLE, "long", BitOR($oldStyle[0], $SS_BITMAP)) If @error Then Return SetError(4, 0, 0) Local $oldBmp = DllCall("user32.dll", "handle", "SendMessageW", "hwnd", $iCtrlId, "int", $STM_SETIMAGE, "wparam", $IMAGE_BITMAP, "handle", $hBitmap) If @error Then Return SetError(5, 0, 0) If $oldBmp[0] Then _WinAPI_DeleteObject($oldBmp[0]) Return 1 EndFunc