I am trying to create a simple script using pixelsearch.
pixelsearch, fx, fy, 0, 0, 0, 0, 0xFF00FF, 99, Fast RGB
what I want is search the pixel 0xFF00FF until 0xFF99FF(which ever will found from that variation). Its like, I only want the variation in G element and R=FF and B=FF still(I want to keep R and B the same value). Sorry for bad English.
Pixelsearch and variation Topic is solved
-
- Posts: 13
- Joined: 29 May 2022, 16:20
Re: Pixelsearch and variation Topic is solved
The variation parameter doesn’t allow you to specify that you want to apply it only to one color component, such as green. If you’re only checking one pixel location as your search rectangle of 0,0,0,0 suggests, then you can just use use PixelGetColor and see if the green component is within the desired range, like this:
Code: Select all
PixelGetColor, PixCol, 0, 0, RGB
R := (PixCol & 0xFF0000) >> 16
G := (PixCol & 0x00FF00) >> 8
B := PixCol & 0x0000FF
if (R = 0xFF) && (G <= 0x99) && (B = 0xFF)
MsgBox, % Format("{:#X}", PixCol) " is within the target range"
else
MsgBox, % Format("{:#X}", PixCol) " is not within the target range"
-
- Posts: 13
- Joined: 29 May 2022, 16:20
Re: Pixelsearch and variation
I will try to create my scipt with your idea(which is more on point). I really thank you so much exerting effort to reply to my question.. .
-
- Posts: 13
- Joined: 29 May 2022, 16:20
Re: Pixelsearch and variation
@boiler
I am trying to understand the calculation of pixelsearch variation. Example is 0xFF0A0A if my variation is 10 then it will search from 0xF50000 until 0x?????? well this is where i don't know any more, here is where my head hurts it's because I don't know how to compute it if component is FF + 10variation and I don't know what to exactly search in the internet. Please help me here.
I am trying to understand the calculation of pixelsearch variation. Example is 0xFF0A0A if my variation is 10 then it will search from 0xF50000 until 0x?????? well this is where i don't know any more, here is where my head hurts it's because I don't know how to compute it if component is FF + 10variation and I don't know what to exactly search in the internet. Please help me here.
Re: Pixelsearch and variation
You happened to pick some colors at the top and bottom of the 00-FF range. That means instead of +/- 10 from each component, yours can only be up to 10 less in red (F5 to FF) or 10 more in green and/or blue (00 to 0A). You probably understood this part already.
The important thing to understand is that the range is by each component. You can’t say the allowable range is between is between one full color number and another. For example, it is not correct to say the range is from F50000 to FF0A0A because F5FFFF is in between those numbers (convert them to decimal if it helps you understand), but green and blue are out of range since FF is not between 00 and 0A. That’s why you can’t do checks to see if colors are in range by seeing if it’s between two numbers. You have to break it into components.
It might be easier to understand like this. Let’s have an RGB color system that we set up in decimal where one digit can range from 0 to 9, so 900 is pure red, 090 is pure green, etc. If we want colors to match 555 (a medium gray color) with allowable variation of 2, then each component can range from 3 to 7. But you can’t say the allowable range is 333 to 777 because 399 is between those numbers, but neither green nor blue are between 3 and 7. 400 is also out of range because green and blue are again out of range, but on the other side of their allowable range.
So to answer your question directly, it doesn’t search from one number to another. It gets the color of each pixel and compares each component of it to the reference color. Even though we refer to colors as a 3-byte number (or 4 with the the alpha/transparency channel), it is really just 3 separate bytes that are in a row in memory and we refer to them together. The actual value of the 3-byte number as a whole is almost meaningless and useless — just like the 3-digit value of our made-up decimal color system is meaningless but each digit individually has meaning.
The important thing to understand is that the range is by each component. You can’t say the allowable range is between is between one full color number and another. For example, it is not correct to say the range is from F50000 to FF0A0A because F5FFFF is in between those numbers (convert them to decimal if it helps you understand), but green and blue are out of range since FF is not between 00 and 0A. That’s why you can’t do checks to see if colors are in range by seeing if it’s between two numbers. You have to break it into components.
It might be easier to understand like this. Let’s have an RGB color system that we set up in decimal where one digit can range from 0 to 9, so 900 is pure red, 090 is pure green, etc. If we want colors to match 555 (a medium gray color) with allowable variation of 2, then each component can range from 3 to 7. But you can’t say the allowable range is 333 to 777 because 399 is between those numbers, but neither green nor blue are between 3 and 7. 400 is also out of range because green and blue are again out of range, but on the other side of their allowable range.
So to answer your question directly, it doesn’t search from one number to another. It gets the color of each pixel and compares each component of it to the reference color. Even though we refer to colors as a 3-byte number (or 4 with the the alpha/transparency channel), it is really just 3 separate bytes that are in a row in memory and we refer to them together. The actual value of the 3-byte number as a whole is almost meaningless and useless — just like the 3-digit value of our made-up decimal color system is meaningless but each digit individually has meaning.
-
- Posts: 13
- Joined: 29 May 2022, 16:20
Re: Pixelsearch and variation
Yes! I red and red your reply and had more research and also played with a color picker. Helped me a lot. I thank you so much for sharing ideas... thank you! thank you! thank you!boiler wrote: ↑03 Jun 2022, 06:23You happened to pick some colors at the top and bottom of the 00-FF range. That means instead of +/- 10 from each component, yours can only be up to 10 less in red (F5 to FF) or 10 more in green and/or blue (00 to 0A). You probably understood this part already.
The important thing to understand is that the range is by each component. You can’t say the allowable range is between is between one full color number and another. For example, it is not correct to say the range is from F50000 to FF0A0A because F5FFFF is in between those numbers (convert them to decimal if it helps you understand), but green and blue are out of range since FF is not between 00 and 0A. That’s why you can’t do checks to see if colors are in range by seeing if it’s between two numbers. You have to break it into components.
It might be easier to understand like this. Let’s have an RGB color system that we set up in decimal where one digit can range from 0 to 9, so 900 is pure red, 090 is pure green, etc. If we want colors to match 555 (a medium gray color) with allowable variation of 2, then each component can range from 3 to 7. But you can’t say the allowable range is 333 to 777 because 399 is between those numbers, but neither green nor blue are between 3 and 7. 400 is also out of range because green and blue are again out of range, but on the other side of their allowable range.
So to answer your question directly, it doesn’t search from one number to another. It gets the color of each pixel and compares each component of it to the reference color. Even though we refer to colors as a 3-byte number (or 4 with the the alpha/transparency channel), it is really just 3 separate bytes that are in a row in memory and we refer to them together. The actual value of the 3-byte number as a whole is almost meaningless and useless — just like the 3-digit value of our made-up decimal color system is meaningless but each digit individually has meaning.