ahmeddzcom Posted July 15, 2022 Share Posted July 15, 2022 Hello I need change any color if not white to black color image to black image --- Also, I already try with this code , and it didn't work Change image pixel colors - AutoIt General Help and Support - AutoIt Forums (autoitscript.com) tnx Link to comment Share on other sites More sharing options...
Nine Posted July 15, 2022 Share Posted July 15, 2022 See my Screen Scraping UDF with last reply example... “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
ahmeddzcom Posted July 15, 2022 Author Share Posted July 15, 2022 15 hours ago, Nine said: See my Screen Scraping UDF with last reply example... i try with your Screen Scraping , But I didn't get any result. I think because of my poor English and my little autoit experience. Link to comment Share on other sites More sharing options...
Solution Nine Posted July 15, 2022 Solution Share Posted July 15, 2022 (edited) 56 minutes ago, ahmeddzcom said: i try with your Screen Scraping , But I didn't get any result. I think because of my poor English and my little autoit experience. Maybe you do not need the UDF after all. If the souce is a file then this should work : #include <GDIPlus.au3> _GDIPlus_Startup() Local $hImage = _GDIPlus_ImageLoadFromFile("Torus.jpg") Local $iWidth = _GDIPlus_ImageGetWidth($hImage), $iHeight = _GDIPlus_ImageGetHeight($hImage) Local $tLock = _GDIPlus_BitmapLockBits($hImage, 0, 0, $iWidth, $iHeight, BitOR($GDIP_ILMWRITE, $GDIP_ILMREAD), $GDIP_PXF32ARGB) Local $tPixel = DllStructCreate("int color[" & $iWidth * $iHeight & "];", $tLock.scan0) For $i = 1 To $iWidth * $iHeight If $tPixel.color(($i)) <> 0xFFFFFFFF Then $tPixel.color(($i)) = 0xFF000000 Next _GDIPlus_BitmapUnlockBits($hImage, $tPixel) _GDIPlus_ImageSaveToFile($hImage, "Test.jpg") _GDIPlus_ImageDispose($hImage) _GDIPlus_Shutdown() Edited July 15, 2022 by Nine ahmeddzcom 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
ahmeddzcom Posted July 15, 2022 Author Share Posted July 15, 2022 31 minutes ago, Nine said: Show the code you tried, because as you can see previous topic solved the same issue you are having. What is the source of your image ? Show the code you tried : I don't have code , I just edited the previous codes source of your image : Best 100+ Natural Images [HD] | Download Free Nature Pictures - Unsplash Link to comment Share on other sites More sharing options...
ahmeddzcom Posted July 15, 2022 Author Share Posted July 15, 2022 51 minutes ago, Nine said: Maybe you do not need the UDF after all. If the souce is a file then this should work : #include <GDIPlus.au3> _GDIPlus_Startup() Local $hImage = _GDIPlus_ImageLoadFromFile("Torus.jpg") Local $iWidth = _GDIPlus_ImageGetWidth($hImage), $iHeight = _GDIPlus_ImageGetHeight($hImage) Local $tLock = _GDIPlus_BitmapLockBits($hImage, 0, 0, $iWidth, $iHeight, BitOR($GDIP_ILMWRITE, $GDIP_ILMREAD), $GDIP_PXF32ARGB) Local $tPixel = DllStructCreate("int color[" & $iWidth * $iHeight & "];", $tLock.scan0) For $i = 1 To $iWidth * $iHeight If $tPixel.color(($i)) <> 0xFFFFFFFF Then $tPixel.color(($i)) = 0xFF000000 Next _GDIPlus_BitmapUnlockBits($hImage, $tPixel) _GDIPlus_ImageSaveToFile($hImage, "Test.jpg") _GDIPlus_ImageDispose($hImage) _GDIPlus_Shutdown() this is what i need . thanks. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now