Jump to content

Changing pixel color _ image


Go to solution Solved by Nine,

Recommended Posts

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 post
Share on other sites
  • Solution
Posted (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 by Nine
Link to post
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 post
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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...