Jump to content

Changing pixel color _ image


Go to solution Solved by Nine,

Recommended Posts

  • Solution
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 by Nine
Link to comment
Share on other sites

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...