Jump to content

open a png file and read the color of a particular pixel?


Guest
 Share

Recommended Posts

I want to open a png file and read the color of a particular pixel.

I found that someone wrote this for bmp files:

; #FUNCTION# ====================================================================================================================

; Name...........: _PixelRead

; Description ...: Returns the color at the pixel coordinate and BMPHandle given.

; Syntax.........: _PixelRead($BMPHandle,$X,$Y)

; Parameters ....: $BMPHandle - ""

; $X - X coordinate of the pixel

; $Y - ""

; Return values .: Success - A Color as a hex string in RRGGBB format

; #FUNCTION# ====================================================================================================================

Func _PixelRead(ByRef $BMPHandle,$x,$y)

But I prefer to work on a png or jpg..

Edited by Guest
Link to comment
Share on other sites

what logan is suggesting i think is to forget about the file type. PixelGetColor() works with anything - the png has been opened and is visible on the desktop, so PixelGetColor() will work. look at the example code

also see PixelCoordMode() under AutoItSetOption

if you're wanting to get the color based on mouse position, see MouseGetPos()

FUNCTIONS: WinDock (dock window to screen edge) | EditCtrl_ToggleLineWrap (line/word wrap for AU3 edit control) | SendEX (yet another alternative to Send( ) ) | Spell Checker (Hunspell wrapper) | SentenceCase (capitalize first letter of sentences)

CODE SNIPPITS: Dynamic tab width (set tab control width according to window width)

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...